public static <T> T[] assertNotEmpty(T[] value, String name) { return assertNotEmpty(value, name, NullPointerException.class, IllegalArgumentException.class); } public static <T, X1 extends Exception, X2 extends Exception> T[] assertNotEmpty(T[] value, String name, Class<X1> nullType, Class<X2> type) throws X1, X2 {
public static <T> Collection<T> assertNotEmpty(Collection<T> value, String name) { return assertNotEmpty(value, name, NullPointerException.class, IllegalArgumentException.class); } public static <T, X1 extends Exception, X2 extends Exception> Collection<T> assertNotEmpty(Collection<T> value, String name, Class<X1> nullType, Class<X2> type) throws X1, X2 {
public static int lastIndexOfExpected(Object value, Collection<String> strings) { ExceptionUtils.assertNotEmpty(strings, "strings"); String text = ExceptionUtils.assertNotNull(value, "value").toString(); int pos = text.length(); for (String string : strings) { pos = text.lastIndexOf(string, pos); assertContentFound(pos); } return pos; }
public static int indexOfExpected(Object value, Collection<String> strings) { int pos = -1; ExceptionUtils.assertNotEmpty(strings, "strings"); String text = ExceptionUtils.assertNotNull(value, "value").toString(); for (String string : strings) { pos = text.indexOf(string, pos+1); assertContentFound(pos); } return pos; }