public static void main(String[] args) throws IOException { Map<String,String> map = new HashMap<String,String>(); map.put( "a" , "aasdf" ); map.put( "3" , "fffff" ); map.put( "2" , "jljlj" ); for (Entry<String, String> e : map.entrySet()){ System.out.println( "key: " + e.getKey()+ " hashCode: " + e.getKey().hashCode()); } } 输出: key: 3 hashCode: 51 key: 2 hashCode: 50 key: a hashCode: 97
|