@Test public void testIsPalindrome() { Palindrome palindrome = new Palindrome(); assertTrue(palindrome.isPalindrome(new String("a"))); assertTrue(palindrome.isPalindrome(new String("racecar"))); assertTrue(palindrome.isPalindrome(new String("noon"))); assertFalse(palindrome.isPalindrome(new String("horse"))); assertFalse(palindrome.isPalindrome(new String("rancor"))); assertFalse(palindrome.isPalindrome(new String("aaaaab"))); CharacterComparator cc = new OffByOne(); assertTrue(palindrome.isPalindrome(new String("a"),cc)); assertTrue(palindrome.isPalindrome(new String("flake"),cc)); }
public boolean isPalindrome(String word) { Deque<Character> deque = wordToDeque(word); while(deque.size() > 1) { if(deque.removeFirst() != deque.removeLast()) { return false; } } return true; }
Palindrome { public boolean isPalindrome(String word) { Deque<Character> deque = wordToDeque(word); while(deque.size() > 1) { if(deque.removeFirst() != deque.removeLast()) { return false; } } return true; } }
Palindrome { public boolean isPalindrome(String word) { Deque<Character> deque = wordToDeque(word); while(deque.size() > 1) { if(deque.removeFirst() != deque.removeLast()) { return false; } } return true; }  }
Palindrome { public boolean isPalindrome(String word) { Deque<Character> deque = wordToDeque(word); while(deque.size() > 1) { if(deque.removeFirst() != deque.removeLast()) { return false; } } return true; }  Deque<Character> wordToDeque(String word); boolean isPalindrome(String word); boolean isPalindrome(String word, CharacterComparator cc); }
Palindrome { public boolean isPalindrome(String word) { Deque<Character> deque = wordToDeque(word); while(deque.size() > 1) { if(deque.removeFirst() != deque.removeLast()) { return false; } } return true; }  Deque<Character> wordToDeque(String word); boolean isPalindrome(String word); boolean isPalindrome(String word, CharacterComparator cc);  }