A Java hash code is 32bits. The number of possible strings it hashes is infinite.
So yes, there will be collisions. The percentage is meaningless – there is an infinite number of items (strings) and a finite number of possible hashes.
More Related Contents:
- How can I generate an MD5 hash in Java?
- Best implementation for hashCode method for a collection
- Why use a prime number in hashCode?
- Memory address of variables in Java
- What is an object’s hash code if hashCode() is not overridden?
- Understanding the workings of equals and hashCode in a HashMap
- What is the use of hashCode in Java?
- Good Hash Function for Strings
- How should equals and hashcode be implemented when using JPA and Hibernate
- How is hashCode() calculated in Java
- How to ensure hashCode() is consistent with equals()?
- How do you get the “object reference” of an object in java when toString() and hashCode() have been overridden?
- Why doesn’t String’s hashCode() cache 0?
- How does Java order items in a HashMap or a HashTable?
- How to get the unique ID of an object which overrides hashCode()?
- Hashcode and Equals for Hashset [duplicate]
- Why should I override hashCode() when I override equals() method?
- What is an “internal address” in Java?
- Double in HashMap
- what is the difference between == operator and equals()? (with hashcode() ???)
- Should I write equals() and hashCode() methods in JPA entities?
- What is a sensible prime for hashcode calculation?
- What exactly is bucket in hashmap?
- Mutable objects and hashCode
- Hashcode and equals
- Is it possible in java make something like Comparator but for implementing custom equals() and hashCode()
- How default .equals and .hashCode will work for my classes?
- hashCode uniqueness
- Java: Use hashCode() inside of equals() for convenience?
- Bit-shifting in Effective Java hashCode() implementation