SimpleStringHasher extends AbstractStringHasher { @Override public int getHashCode(char[] string, int start, int end) { int hash = 0; for (int i = start; i < end; i++) { hash = hash * 31 + string[i]; } return hash; } SimpleStringHasher(); @Override int getHashCode(char[] string, int start, int end);  }
@Test public void testCompatibleHashCode() { StringHasher hasher = getStringHasher(); String s; s = ""; Assert.assertEquals(s.hashCode(), hasher.getHashCode(s)); s = "Hello World"; Assert.assertEquals(s.hashCode(), hasher.getHashCode(s)); s = TestValues.THAI_SENTENCE; Assert.assertEquals(s.hashCode(), hasher.getHashCode(s)); }