Java Utililty Methods SortedMap Usage

List of utility methods to do SortedMap Usage

Description

The list of methods to do SortedMap Usage are organized into topic(s).

Method

longcomputeByteSizeM(SortedMap byteSizeByName)
Computes total byte size.
long totalByteSize = 0;
for (Long byteSize : byteSizeByName.values()) {
    totalByteSize += byteSize.longValue();
return totalByteSize;
ListcomputePathCauselessLms( List>> depCausesByNameList)
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();
...
SortedMapfilterPrefix(SortedMap baseMap, String prefix)
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;
SortedMapfind(SortedMap map, String baseName)
find
return map.subMap(baseName, baseName.concat("\uFFFF"));
TfirstElement(Collection c)
first Element
if (c == null || c.size() == 0) {
    return null;
} else {
    return c.iterator().next();
TfirstElement(Collection c)
first Element
if (isEmpty(c)) {
    return null;
return c.iterator().next();
StringgeneratePropertiesFilter(SortedMap propertiesMap)
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 "";
ListgetAll(SortedMap map)
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;
...
UgetObjectSortedMap(SortedMap map, T key)
get Object Sorted Map
if (map == null) {
    return null;
return map.get(key);
booleanisCollectionClass(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;