Methods Summary |
---|
public static android.util.ArraySet | newArraySet()Creates a {@code ArraySet} instance.
return new ArraySet<E>();
|
public static android.util.ArraySet | newArraySet(E elements)Creates a {@code ArraySet} instance containing the given elements.
int capacity = elements.length * 4 / 3 + 1;
ArraySet<E> set = new ArraySet<E>(capacity);
Collections.addAll(set, elements);
return set;
|
public static java.util.HashSet | newHashSet()Creates an empty {@code HashSet} instance.
Note: if {@code E} is an {@link Enum} type, use {@link
EnumSet#noneOf} instead.
Note: if you only need an immutable empty Set,
use {@link Collections#emptySet} instead.
return new HashSet<K>();
|
public static java.util.HashSet | newHashSet(E elements)Creates a {@code HashSet} instance containing the given elements.
Note: due to a bug in javac 1.5.0_06, we cannot support the
following:
{@code Set set = Sets.newHashSet(sub1, sub2);}
where {@code sub1} and {@code sub2} are references to subtypes of {@code
Base}, not of {@code Base} itself. To get around this, you must use:
{@code Set set = Sets.newHashSet(sub1, sub2);}
int capacity = elements.length * 4 / 3 + 1;
HashSet<E> set = new HashSet<E>(capacity);
Collections.addAll(set, elements);
return set;
|
public static java.util.SortedSet | newSortedSet()Creates an empty {@code SortedSet} instance.
return new TreeSet<E>();
|
public static java.util.SortedSet | newSortedSet(E elements)Creates a {@code SortedSet} instance containing the given elements.
SortedSet<E> set = new TreeSet<E>();
Collections.addAll(set, elements);
return set;
|