@Test(groups = "fast") public void testApplies() { Assert.assertTrue(CollectionUtil.applies(null, "foo")); Assert.assertTrue(CollectionUtil.applies(new String[]{}, "foo")); Assert.assertTrue(CollectionUtil.applies(new String[]{"bar", "foo"}, "foo")); Assert.assertFalse(CollectionUtil.applies(new String[]{"bar", "f00"}, "foo")); Assert.assertFalse(CollectionUtil.applies(new String[]{"!bar", "!foo"}, "foo")); Assert.assertTrue(CollectionUtil.applies(new String[]{"!bar", "!f00"}, "foo")); }
public static boolean applies(String events[], String event) { if (events == null || events.length == 0) { return true; } boolean isPositive = events[0].charAt(0) != '!'; if (isPositive) { return contains(events, event); } else { return !contains(events, "!" + event); } }
CollectionUtil { public static boolean applies(String events[], String event) { if (events == null || events.length == 0) { return true; } boolean isPositive = events[0].charAt(0) != '!'; if (isPositive) { return contains(events, event); } else { return !contains(events, "!" + event); } } }
CollectionUtil { public static boolean applies(String events[], String event) { if (events == null || events.length == 0) { return true; } boolean isPositive = events[0].charAt(0) != '!'; if (isPositive) { return contains(events, event); } else { return !contains(events, "!" + event); } }  }
CollectionUtil { public static boolean applies(String events[], String event) { if (events == null || events.length == 0) { return true; } boolean isPositive = events[0].charAt(0) != '!'; if (isPositive) { return contains(events, event); } else { return !contains(events, "!" + event); } }  static boolean contains(Object[] arr, Object item); static boolean empty(String[] arr); static boolean applies(String events[], String event); static Object[] asObjectArray(Object in); static List<Object> asList(Object in); static List<T> asList(Iterable<T> in); }
CollectionUtil { public static boolean applies(String events[], String event) { if (events == null || events.length == 0) { return true; } boolean isPositive = events[0].charAt(0) != '!'; if (isPositive) { return contains(events, event); } else { return !contains(events, "!" + event); } }  static boolean contains(Object[] arr, Object item); static boolean empty(String[] arr); static boolean applies(String events[], String event); static Object[] asObjectArray(Object in); static List<Object> asList(Object in); static List<T> asList(Iterable<T> in);  }