public static <T> Iterator<T> fromArray(T[] ary) { if (ary == null || ary.length == 0) { return empty(); } return new AIndexedIterator.ArrayIterator<T>(ary); }
public static <T> IOpenIterator<T> fromEnumeration(Enumeration<T> enumeration) { if (enumeration == null) { return empty(); } return new EnumerationIterator<T>(enumeration); }
public static Iterator<Object> fromArrayObj(Object ary) { if (ary == null) { return empty(); } return new AIndexedIterator.AnyArrayIterator(ary); }
@Override public void close() { if (deployRepo instanceof Closeable) { // Close repo connection after validation IOUtils.closeQuietly((Closeable) deployRepo); } } }
/** * Return {@code true} if an array contains at least one element. This * method is inverse to {@link #isEmpty(T[])}. * * @param array the checked array. * @return {@code true} if the array contains at least one element. */ public static <T> boolean isNotEmpty(T[] array) { return !isEmpty(array); }
/** * Checks if there are tests, including tests with test cases, runs with filled runs, tests without cases(empty), * runs without any parameters and tests without cases and runs. */ public boolean isHasAnyTests() { return CollectionUtils.isNotEmpty(allTests); }
public static boolean containsAll(float[] ary1, float[] ary2) { if (ary1 == null || ary2 == null) { return false; } for (float arrayElement : ary2) { if (!contains(ary1, arrayElement)) { return false; } } return true; }
/** * Converts a date to the String value according the default locale. * * @param date * @return String date format * @throws Exception */ public static String dateToString(Date date) throws Exception { return dateToString(date, null); } }
@Override public IOpenIterator<T> reverse() { ArrayIterator<T> it = new ArrayIterator<T>(ary, from, to, step); it.reverseIndexes(); return it; }
public static Integer lastDayOfMonth(Date d) { if (d == null) { return null; } return getLastDayOfMonth(d); }
protected void reverseIndexes() { int s = size(); if (s <= 0) { return; } int newFrom = from + (s - 1) * step; step = -step; to = newFrom + s * step; current = from = newFrom; }
@Override public boolean hasNext() { if (!hasNext) { findNext(); } return hasNext; }
/** * Return the difference in weeks before endDate and startDate. * * @param endDate the date that is considered to be the later one * @param startDate the date that is considered to be the earlier one * @return positive integer if endDate is greater than startDate, in other * case the result will be negative. */ public static Integer getDifferenceInWeeks(Date endDate, Date startDate) { return getDateDiff(Calendar.WEEK_OF_YEAR, endDate, startDate); }
public static boolean containsAll(byte[] ary1, byte[] ary2) { if (ary1 == null || ary2 == null) { return false; } for (byte arrayElement : ary2) { if (!contains(ary1, arrayElement)) { return false; } } return true; }
public static <T> Iterator<T> fromArray(T[] ary) { if (ary == null || ary.length == 0) { return empty(); } return new AIndexedIterator.ArrayIterator<T>(ary); }
public static <T> IOpenIterator<T> fromEnumeration(Enumeration<T> enumeration) { if (enumeration == null) { return empty(); } return new EnumerationIterator<T>(enumeration); }
public static Iterator<Object> fromArrayObj(Object ary) { if (ary == null) { return empty(); } return new AIndexedIterator.AnyArrayIterator(ary); }
public static boolean containsAll(char[] ary1, char[] ary2) { if (ary1 == null || ary2 == null) { return false; } for (char arrayElement : ary2) { if (!contains(ary1, arrayElement)) { return false; } } return true; }