@Test public void testEqualChars() { assertTrue(offByOne.equalChars('a', 'b')); assertTrue(offByOne.equalChars('r', 'q')); assertFalse(offByOne.equalChars('a', 'e')); assertFalse(offByOne.equalChars('z', 'a')); assertFalse(offByOne.equalChars('a', 'a')); }
@Override public boolean equalChars(char x, char y) { int diff = Math.abs(y - x); if(diff == 1){ return true; } return false; }
OffByOne implements CharacterComparator { @Override public boolean equalChars(char x, char y) { int diff = Math.abs(y - x); if(diff == 1){ return true; } return false; } }
OffByOne implements CharacterComparator { @Override public boolean equalChars(char x, char y) { int diff = Math.abs(y - x); if(diff == 1){ return true; } return false; }  }
OffByOne implements CharacterComparator { @Override public boolean equalChars(char x, char y) { int diff = Math.abs(y - x); if(diff == 1){ return true; } return false; }  @Override boolean equalChars(char x, char y); }
OffByOne implements CharacterComparator { @Override public boolean equalChars(char x, char y) { int diff = Math.abs(y - x); if(diff == 1){ return true; } return false; }  @Override boolean equalChars(char x, char y);  }