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


    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() +" "
    + new String(b1).hashCode() +" "
    + new String(b2).hashCode() +" "
    + new String(b3).hashCode() +" "
    + new String(b4).hashCode() +" "
    + new String(b5).hashCode() +" "
    + new String(b6).hashCode() +" "
    + new String(b7).hashCode() +" "
    + new String(b8).hashCode() +" "
    + new String(b9).hashCode() +" "


    );

    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);


    }

  • 相关阅读:
    Future接口和Callable接口以及FeatureTask详解
    puppet的使用:ERB模板介绍
    puppet的使用:依赖关系整理
    数字证书常见格式整理
    c3p0配置文件
    dockerfile简述
    Grape简介
    keytool和openssl生成的证书转换
    Grape教程-params
    耿丹CS16-2班助教总结
  • 原文地址:https://www.cnblogs.com/cs-lcy/p/10790925.html
Copyright © 2020-2023  润新知