public static void main(String[] a){

byte[] b1 = {33 , 123 ,124};
byte[] b2 = {33 , 124 , 93};

byte[] b3 = {33 ,125, 62};
byte[] b4 = {34 , 92 , 124};

byte[] b5 = {34 , 93 , 93};
byte[] b6 = {34 , 94 , 62};

byte[] b7 = {35 , 61 ,124};
byte[] b8 = {35 , 62, 93};

byte[] b9 = {35 , 63, 62};
System.out.println( new String(b1).hashCode() +"\n"
+ new String(b1).hashCode() +"\n"
+ new String(b2).hashCode() +"\n"
+ new String(b3).hashCode() +"\n"
+ new String(b4).hashCode() +"\n"
+ new String(b5).hashCode() +"\n"
+ new String(b6).hashCode() +"\n"
+ new String(b7).hashCode() +"\n"
+ new String(b8).hashCode() +"\n"
+ new String(b9).hashCode() +"\n"

);

Map<String,Integer> map = new HashMap<String,Integer>();
map.put(new String(b1),1123);
map.put(new String(b2),1);
map.put(new String(b3),1);
map.put(new String(b4),1);
map.put(new String(b5),1);
map.put(new String(b6),1);
map.put(new String(b7),1);
map.put(new String(b8),1);
map.put(new String(b9),1);

System.out.println(123);
int abc= map.get(new String(b1));
System.out.println(abc);

}

多个字符串有相同的hashcode(没见到大于8的时候转成红黑树)的更多相关文章

  1. PAT 甲级 1144 The Missing Number (20 分)(简单,最后一个测试点没过由于开的数组没必要大于N)

    1144 The Missing Number (20 分)   Given N integers, you are supposed to find the smallest positive in ...

  2. Codeforces Round #429 (Div. 2) A. Generous Kefa【hash/判断字符串是否有一种字符个数大于m】

    A. Generous Kefa time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  3. Longest Palindromic Substring (最长回文字符串)——两种方法还没看,仍需认真看看

    Given a string S, find the longest palindromic substring in S. You may assume that the maximum lengt ...

  4. js替换字符串中的空格,换行符\r\n或\n替换成<br>

    为了让回车换行符正确显示,需要将 \n 或 \r\n 替换成 <br>.同样地,将空格替换存  .这里我们通过正则表达式来替换. 一.替换所有的空格.回车换行符 //原始字符串 var s ...

  5. ajax 请求发出了,数据更改了,但是没进入success 函数 把success 换成 complete

    $(function(){ $(document).on('tap','.w-location-group .mui-table-view-cell',function(){ var bool = $ ...

  6. Java 容器源码分析之1.7HashMap

    以下内容基于jdk1.7.0_79源码: 什么是HashMap 基于哈希表的一个Map接口实现,存储的对象是一个键值对对象(Entry<K,V>): HashMap补充说明 基于数组和链表 ...

  7. java容器源码分析及常见面试题笔记

      概览 容器主要包括 Collection 和 Map 两种,Collection 存储着对象的集合,而 Map 存储着键值对(两个对象)的映射表. List Arraylist: Object数组 ...

  8. Java HashMap源码分析(含散列表、红黑树、扰动函数等重点问题分析)

    写在最前面 这个项目是从20年末就立好的 flag,经过几年的学习,回过头再去看很多知识点又有新的理解.所以趁着找实习的准备,结合以前的学习储备,创建一个主要针对应届生和初学者的 Java 开源知识项 ...

  9. Java--集合框架详解

    前言 Java集合框架的知识在Java基础阶段是极其重要的,我平时使用List.Set和Map集合时经常出错,常用方法还记不牢, 于是就编写这篇博客来完整的学习一下Java集合框架的知识,如有遗漏和错 ...

随机推荐

  1. Java——值传递与引用传递

    1.基本类型和引用类型在内存中的保存 (1)基本类型的变量保存原始值,即它代表的值就是数值本身:   基本类型在声明变量时就为它分配了空间:   基本类型在参数传递过程中属于值传递,也就是复制一份数据 ...

  2. OpenStack-Queens版本缓存yum源的问题

    安装OpenStack仓库出现问题 yum install centos-release-openstack-queens -y 执行 sed -i 's/$contentdir/centos/g' ...

  3. [linux-脚本]shebang(shabang #!)

    使用Linux或者unix系统的人们对#!这个符号都不陌生,但要说出个具体的所以然来,很多人估计还真不行,我们有必要就此整理一下.Shebang这个符号通常在Unix系统的脚本中第一行开头中写到,它指 ...

  4. Flutter错误集合

    一.Waiting for another flutter command to release the startup lock... 运行flutter命令 flutter upgrade 运行 ...

  5. day 14 三元运算符,列表字典推导式,递归,匿名函数,内置函数(排序,映射,过滤,合并)

    一.三元运算符 就是if.....else..... 语法糖 前提:if和else只有一条语句 #原始版 cmd=input('cmd') if cmd.isdigit(): print('1') e ...

  6. c++ string 转double

    #include <iostream>#include <sstream> //使用stringstream需要引入这个头文件using namespace std; Type ...

  7. Python02(Linux命令)

    Trainning-day01回顾 1.who :查看登录到系统的用户信息 2.pwd :查看当前所在路径 3.ls :查看当前目录的内容 ls -l ls -a ls -la / ls -l -a ...

  8. JavaScript中的各种宽高总结

    window和document首先我们来高清两个概念:    window和document的区别是什么?    window.location和document.location是一样吗?第一个问题 ...

  9. 大数字加法(hduoj)

    Problem Description I have a very simple problem for you. Given two integers A and B, your job is to ...

  10. postman的安装和使用

    在后端开发的过程中,没有前端代码可以配合测试已完成的代码是否有问题,这个时候就需要postman来帮忙解决.对于后端人员来说,postman是很好的测试工具,下面具体讲下怎么安装postman,本次安 ...