Android Set Union sortedUnion(Set a, Set b)

Here you can find the source of sortedUnion(Set a, Set b)

Description

Constructs the sorted union of two sets

License

Open Source License

Parameter

Parameter Description
a a parameter
b a parameter

Return

the sorted union

Declaration

public static <T> SortedSet<T> sortedUnion(Set<T> a, Set<T> b) 

Method Source Code

//package com.java2s;

import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

public class Main {
    /**/*from w w w  .jav a2s .  com*/
     * Constructs the sorted union of two sets
     * @param a
     * @param b
     * @return the sorted union
     */
    public static <T> SortedSet<T> sortedUnion(Set<T> a, Set<T> b) {
        SortedSet<T> retVal = new TreeSet<T>(a);
        retVal.addAll(b);
        return retVal;
    }
}