com.jdroid.java.collections
Class Sets

java.lang.Object
  extended by com.jdroid.java.collections.Sets

public class Sets
extends Object


Constructor Summary
Sets()
           
 
Method Summary
static
<E> HashSet<E>
newHashSet()
          Creates a mutable, empty HashSet instance.
static
<E> HashSet<E>
newHashSet(E... elements)
          Creates a mutable HashSet instance containing the given elements in unspecified order.
static
<E> HashSet<E>
newHashSet(Iterable<? extends E> elements)
          Creates a mutable HashSet instance containing the given elements in unspecified order.
static
<E> HashSet<E>
newHashSet(Iterator<? extends E> elements)
          Creates a mutable HashSet instance containing the given elements in unspecified order.
static
<E> LinkedHashSet<E>
newLinkedHashSet()
          Creates a mutable, empty LinkedHashSet instance.
static
<E> LinkedHashSet<E>
newLinkedHashSet(Iterable<? extends E> elements)
          Creates a mutable LinkedHashSet instance containing the given elements in order.
static
<E extends Comparable<?>>
TreeSet<E>
newTreeSet()
          Creates a mutable, empty TreeSet instance sorted by the natural sort ordering of its elements.
static
<E extends Comparable<?>>
TreeSet<E>
newTreeSet(Iterable<? extends E> elements)
          Creates a mutable TreeSet instance containing the given elements sorted by their natural ordering.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sets

public Sets()
Method Detail

newHashSet

public static <E> HashSet<E> newHashSet()
Creates a mutable, empty HashSet instance.

Returns:
a new, empty HashSet

newHashSet

public static <E> HashSet<E> newHashSet(E... elements)
Creates a mutable HashSet instance containing the given elements in unspecified order.

Parameters:
elements - the elements that the set should contain
Returns:
a new HashSet containing those elements (minus duplicates)

newHashSet

public static <E> HashSet<E> newHashSet(Iterable<? extends E> elements)
Creates a mutable HashSet instance containing the given elements in unspecified order.

Parameters:
elements - the elements that the set should contain
Returns:
a new HashSet containing those elements (minus duplicates)

newHashSet

public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements)
Creates a mutable HashSet instance containing the given elements in unspecified order.

Parameters:
elements - the elements that the set should contain
Returns:
a new HashSet containing those elements (minus duplicates)

newLinkedHashSet

public static <E> LinkedHashSet<E> newLinkedHashSet()
Creates a mutable, empty LinkedHashSet instance.

Returns:
a new, empty LinkedHashSet

newLinkedHashSet

public static <E> LinkedHashSet<E> newLinkedHashSet(Iterable<? extends E> elements)
Creates a mutable LinkedHashSet instance containing the given elements in order.

Parameters:
elements - the elements that the set should contain, in order
Returns:
a new LinkedHashSet containing those elements (minus duplicates)

newTreeSet

public static <E extends Comparable<?>> TreeSet<E> newTreeSet()
Creates a mutable, empty TreeSet instance sorted by the natural sort ordering of its elements.

Returns:
a new, empty TreeSet

newTreeSet

public static <E extends Comparable<?>> TreeSet<E> newTreeSet(Iterable<? extends E> elements)
Creates a mutable TreeSet instance containing the given elements sorted by their natural ordering.

Parameters:
elements - the elements that the set should contain
Returns:
a new TreeSet containing those elements (minus duplicates)


Copyright © 2014. All rights reserved.