Skip to content

Commit

Permalink
change the ArrayList into List
Browse files Browse the repository at this point in the history
  • Loading branch information
MherBaghinyan committed Jan 21, 2019
1 parent 9f798d4 commit 5c1a0a0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ public static boolean containsWordsPatternMatch(String inputString, String[] wor
}

public static boolean containsWordsJava8(String inputString, String[] words) {
ArrayList inputStringList = new ArrayList<>(Arrays.asList(inputString.split(" ")));
ArrayList<String> wordsList = new ArrayList<>(Arrays.asList(words));
List inputStringList = Arrays.asList(inputString.split(" "));
List<String> wordsList = Arrays.asList(words);

return wordsList.stream().allMatch(inputStringList::contains);
}

public static boolean containsWordsArray(String inputString, String[] words) {
ArrayList inputStringList = new ArrayList<>(Arrays.asList(inputString.split(" ")));
ArrayList<String> wordsList = new ArrayList<>(Arrays.asList(words));
List inputStringList = Arrays.asList(inputString.split(" "));
List<String> wordsList = Arrays.asList(words);

return inputStringList.containsAll(wordsList);
}
Expand Down

0 comments on commit 5c1a0a0

Please sign in to comment.