Java hashmap max size of 5770?

HashMap is not limited, provided to have a load factor is increased.

In Sun's JVM, HashMap uses an array which is a power of 2. The largest power of two allowed for an array size is 2^30. And the largest number of elements you can have before the HashMap will try to double its size to 2^31 (which it cannot do) is (2^30 * loadFactor) or about 700 million for the default load factor.


HashMap is not limited, your problem is probably you have repeating keys..

I would check if the key is contained already before putting it in the map:

if(temp.containsKey(s)){
 System.out.println("Erasing key "+s+" val "+temp.get(s));
}
temp.put(s, dataFile.getString("users." + s + ".group"));

Tags:

Java

Hashmap