CollectionUtils { public static boolean containsIgnoreCase(final Collection<String> collection, final String matching) { return collection.stream().anyMatch(input -> input.equalsIgnoreCase(matching)); } private  CollectionUtils(); static boolean containsIgnoreCase(final Collection<String> collection, final String matching); static boolean containsUserEstimate(final Collection<Estimate> estimates, final String userName);  }
@Test public void testContainsIgnoreCase() throws Exception { final List<String> inputList = Arrays.asList("John", "Paul", "George", "Ringo"); assertTrue(CollectionUtils.containsIgnoreCase(inputList, "Paul")); assertTrue(CollectionUtils.containsIgnoreCase(inputList, "JOHN")); assertTrue(CollectionUtils.containsIgnoreCase(inputList, "gEoRgE")); assertTrue(CollectionUtils.containsIgnoreCase(inputList, "ringo")); }
@Test public void testNotContainsIgnoreCase() throws Exception { final List<String> inputList = Arrays.asList("John", "Paul", "George", "Ringo"); assertFalse(CollectionUtils.containsIgnoreCase(inputList, "Richard")); }