List of utility methods to do Collection Max
long | calculateMaxTime(Collection Calculate the biggest so the slowest execution time. long maxTime = 0; for (long value : times) { maxTime = value > maxTime ? value : maxTime; return maxTime; |
String | format(String theLabel, Collection> coll, int maxNumberReported, String theClassName) Format a collection, array, or map (internal method). final boolean showCollectionIndexes = false; final int half = (maxNumberReported == 0) ? 10000 : ((maxNumberReported - 1) / 2) + 1; String label = theLabel; if (label == null) { label = ""; final Map<Class<?>, Integer> instancesByClass = new HashMap<Class<?>, Integer>(); final StringBuilder sb = new StringBuilder(label); ... |
int | getMaximumElementLength(final Collection Returns the maximum length of any element in a Collection. int max = 0; for (Object object : collection) { if (object.toString().length() > max) { max = object.toString().length(); return max; |
T | max(Collection extends T> coll) max return Collections.max(coll);
|
Double | max(Collection max return Collections.max(data);
|
double | max(Collection max if (doubles.size() < 1) throw new IllegalArgumentException("No items in list"); Double max = 0d; for (Double doubleVal : doubles) { if (doubleVal > max) max = doubleVal; return max; ... |
Double | max(Collection max List<Double> filteredValues = filterNulls(values); if (filteredValues.size() == 0) return null; return Collections.max(filteredValues); |
int | max(Collection max List<Integer> list = new ArrayList<Integer>(collection); Collections.sort(list); return list.get(list.size() - 1); |
Number | max(Collection max Number max = list.iterator().next(); for (Number item : list) { if (item.floatValue() > max.floatValue()) { max = item; return max; |
String | max(Collection max String max = null; for (String s : strs) { if (max == null || max.compareTo(s) < 0) max = s; return max; |