@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullWordsToSearchInTheMatrix() { wordSearch.contains(new char[0][0], null); }
public boolean contains(char[][] wordSearch, String word) { validateInputData(wordSearch, word); for (int i = 0; i < wordSearch.length; i++) { for (int j = 0; j < wordSearch[i].length; j++) { if (matches(wordSearch, i, j, word.charAt(0))) { if (isWordInWordSearchInner(wordSearch, word, i, j)) { return true; } } } } return false; }
WordSearch { public boolean contains(char[][] wordSearch, String word) { validateInputData(wordSearch, word); for (int i = 0; i < wordSearch.length; i++) { for (int j = 0; j < wordSearch[i].length; j++) { if (matches(wordSearch, i, j, word.charAt(0))) { if (isWordInWordSearchInner(wordSearch, word, i, j)) { return true; } } } } return false; } }
WordSearch { public boolean contains(char[][] wordSearch, String word) { validateInputData(wordSearch, word); for (int i = 0; i < wordSearch.length; i++) { for (int j = 0; j < wordSearch[i].length; j++) { if (matches(wordSearch, i, j, word.charAt(0))) { if (isWordInWordSearchInner(wordSearch, word, i, j)) { return true; } } } } return false; }  }
WordSearch { public boolean contains(char[][] wordSearch, String word) { validateInputData(wordSearch, word); for (int i = 0; i < wordSearch.length; i++) { for (int j = 0; j < wordSearch[i].length; j++) { if (matches(wordSearch, i, j, word.charAt(0))) { if (isWordInWordSearchInner(wordSearch, word, i, j)) { return true; } } } } return false; }  boolean contains(char[][] wordSearch, String word); }
WordSearch { public boolean contains(char[][] wordSearch, String word) { validateInputData(wordSearch, word); for (int i = 0; i < wordSearch.length; i++) { for (int j = 0; j < wordSearch[i].length; j++) { if (matches(wordSearch, i, j, word.charAt(0))) { if (isWordInWordSearchInner(wordSearch, word, i, j)) { return true; } } } } return false; }  boolean contains(char[][] wordSearch, String word);  }