Java Utililty Methods SortedSet

List of utility methods to do SortedSet

Description

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

Method

SortedSetgetEntryOrEmptySet(K key, Map> map)
get Entry Or Empty Set
return (map.containsKey(key) ? map.get(key) : new TreeSet<V>());
SortedSetgetFlatItems(Map> linkedWorkItemIDsMap)
Get the linked workItemIDs
SortedSet<Integer> linkedWorkItemIDsSet = new TreeSet<Integer>();
if (linkedWorkItemIDsMap != null) {
    Iterator<SortedSet<Integer>> iterator = linkedWorkItemIDsMap.values().iterator();
    while (iterator.hasNext()) {
        linkedWorkItemIDsSet.addAll(iterator.next());
return linkedWorkItemIDsSet;
...
SetgetSortedIntersectionValues(Collection colection1, Collection colection2)
get Sorted Intersection Values
Set<T> set = new TreeSet<>();
set.addAll(getIntersectionValues(colection1, colection2));
return set;
SortedSet>getSortedTypes(Class[] types)
get Sorted Types
final TreeSet<Class<?>> classes = new TreeSet<Class<?>>(CLASS_COMPARATOR);
if (types != null) {
    classes.addAll(asList(types));
return classes;
SortedSetintersect(SortedSet pSet1, SortedSet pSet2)
Computes a new set, that is the intersection of set1 and set2.
SortedSet<E> result = new TreeSet<>();
Iterator<E> it1 = pSet1.iterator();
Iterator<E> it2 = pSet2.iterator();
if (!it1.hasNext()) {
    return result;
if (!it2.hasNext()) {
    return result;
...
SortedSetintersectSorted(final Collection c1, final Collection c2)
intersect Sorted
final SortedSet<T> set = new TreeSet<T>();
for (T t : c1) {
    if (c2.contains(t))
        set.add(t);
return set;
SortedSetmapToSortedSet(Map map)
map To Sorted Set
SortedSet result = new TreeSet();
Iterator iter = map.entrySet().iterator();
Map.Entry me;
while (iter.hasNext()) {
    me = (Map.Entry) iter.next();
    result.add(me.getValue());
return result;
...
SortedSetnewSortedSet()
new Sorted Set
return new TreeSet<T>();
intsetDistance(SortedSet s1, SortedSet s2)
Set distance
TreeSet union = new TreeSet(s1);
union.addAll(s2);
int sum = 0;
Iterator uit = union.iterator();
while (uit.hasNext()) {
    String unext = (String) uit.next();
    int increment = (s1.contains(unext) && s2.contains(unext)) ? 0 : 1;
    sum += increment;
...
SortedSetsetminus(SortedSet pSet1, SortedSet pSet2)
Computes a new set, that is the setminus of set1 and set2.
SortedSet<E> result = new TreeSet<>();
Iterator<E> it1 = pSet1.iterator();
while (it1.hasNext()) {
    E elem = it1.next();
    if (!pSet2.contains(elem)) {
        result.add(elem);
return result;