Tag: hashcode java example

hashCode() String Example

November 16, 2014 · 2 min read
###### java.lang.String class comes with many methods towards [increasing performance](http://way2java.com/performance-tuning/how-to-increase-speed-of-execution-performance-in-java/). Think of comparing two strings for their equality, each having 1000 characters. Comparing each character in a for loop is a time cosuming process where performance is lost. Java comes with an idea. Each string is converted into an integer value (following some formula) and then compared. Each string with different characters will have different integer values. The integer value is hash code. Now read further hashCode() String.