List of utility methods to do SortedMap Usage
long | computeByteSizeM(SortedMap Computes total byte size. long totalByteSize = 0; for (Long byteSize : byteSizeByName.values()) { totalByteSize += byteSize.longValue(); return totalByteSize; |
List | computePathCauselessLms( List Removes the causes. final List<String> nameList = new ArrayList<String>(); final int size = depCausesByNameList.size(); for (int i = 0; i < size; i++) { final SortedMap<String, SortedSet<String>> depCausesByName = depCausesByNameList.get(i); if (depCausesByName.size() != 1) { throw new IllegalArgumentException("map size must be 1, but map is " + depCausesByName); final String name = depCausesByName.firstKey(); ... |
SortedMap | filterPrefix(SortedMap filter Prefix if (prefix.length() > 0) { char nextLetter = (char) (prefix.charAt(prefix.length() - 1) + 1); String end = prefix.substring(0, prefix.length() - 1) + nextLetter; return baseMap.subMap(prefix, end); return baseMap; |
SortedMap | find(SortedMap find return map.subMap(baseName, baseName.concat("\uFFFF")); |
T | firstElement(Collection first Element if (c == null || c.size() == 0) { return null; } else { return c.iterator().next(); |
T | firstElement(Collection first Element if (isEmpty(c)) { return null; return c.iterator().next(); |
String | generatePropertiesFilter(SortedMap Generate a Filter as a String given a Map of property/value pairs. if (propertiesMap.size() == 1) { return "(" + propertiesMap.firstKey() + "=" + propertiesMap.get(propertiesMap.firstKey()) + ")"; } else if (propertiesMap.size() > 1) { return "(&" + generatePropertiesFilter( propertiesMap.subMap(propertiesMap.firstKey(), propertiesMap.firstKey() + "\0")) + generatePropertiesFilter(propertiesMap.tailMap(propertiesMap.firstKey() + "\0")) + ")"; return ""; |
List | getAll(SortedMap Given a sorted map with integer keys and entries of type T[] , this method returns a list of all entries of type T in the induced ordering.
List<T> array = new ArrayList<T>(); for (int i : map.keySet()) { T[] entry = map.get(i); for (T t : entry) { array.add(t); return array; ... |
U | getObjectSortedMap(SortedMap get Object Sorted Map if (map == null) { return null; return map.get(key); |
boolean | isCollectionClass(Class> clazz) is Collection Class return clazz == Collection.class || clazz == java.util.List.class || clazz == java.util.Set.class || clazz == java.util.Map.class || clazz == java.util.SortedSet.class || clazz == java.util.SortedMap.class; |