List of utility methods to do SortedSet
Iterable | sorted(Iterable sorted TreeSet<T> ret = new TreeSet<T>(); for (T t : input) { ret.add(t); return ret; |
SortedSet | sortedByValues(Map sort a map by value SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<Map.Entry<K, V>>(new Comparator<Map.Entry<K, V>>() { public int compare(Map.Entry<K, V> e1, Map.Entry<K, V> e2) { int compareTo = e1.getValue().compareTo(e2.getValue()); int direct = 1; if (!asc) { direct = -1; return compareTo * direct; ... |
TreeSet | sortedConfigKeys(Iterable Take a configuration and return a sorted set TreeSet<String> sorted = new TreeSet<String>(); for (Map.Entry<String, String> entry : conf) { sorted.add(entry.getKey()); return sorted; |
SortedSet | sortedSet() Creates an empty SortedSet. return new TreeSet<T>(); |
SortedSet | splitSorted(String str, String sepStr) Split the given string using the given separate, returning the components as a SortedSet. SortedSet<String> result = new TreeSet<String>(); if (str != null) { for (String value : str.split(sepStr)) { if (value.length() > 0) { result.add(value); return result; |
SortedSet | toSortedSet(Comparator Create a set SortedSet<Value> set = new TreeSet<>(comparator); if (values != null && values.length > 0) { for (Value value : values) { set.add(value); return set; |
SortedSet | unionSortedSet(Set union Sorted Set SortedSet<T> unionSet = new TreeSet<T>(); for (Set<T> set : sets) { unionSet.addAll(set); return unionSet; |
Map | valueSortedMap(Map value Sorted Map Set<Entry<K, V>> valueSortedEntries = new TreeSet<Entry<K, V>>(comparator); for (Entry<K, V> entry : map.entrySet()) { valueSortedEntries.add(entry); Map<K, V> sortedMap = new LinkedHashMap<K, V>(map.size()); for (Entry<K, V> entry : valueSortedEntries) { sortedMap.put(entry.getKey(), entry.getValue()); return sortedMap; |