public static int hashCodeIgnoreCase ( String s ) { if ( s == null ) { return 0 ; } int hash = 0 ; int len = s . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = Character . toLowerCase ( s . charAt ( i ) ) ; hash = 31 * hash + c ; } return hash ; }
Get the hashCode of a String insensitive to case without any new Strings being created on the heap .