com.github.andrewoma.dexx.collection
Class HashSet<E>

java.lang.Object
  extended by com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable<E>
      extended by com.github.andrewoma.dexx.collection.internal.base.AbstractIterable<E>
          extended by com.github.andrewoma.dexx.collection.internal.base.AbstractSet<E>
              extended by com.github.andrewoma.dexx.collection.HashSet<E>
All Implemented Interfaces:
Set<E>, Traversable<E>, Iterable<E>

public class HashSet<E>
extends AbstractSet<E>

HashSet is an implementation of Set backed by a HashMap.


Method Summary
 HashSet<E> add(E value)
          Returns a set that adds the specified value if it doesn't already exist in this set.
 boolean contains(E value)
          Returns true if the value exists in this set.
static
<E> HashSet<E>
empty()
           
static
<E> BuilderFactory<E,HashSet<E>>
factory()
           
<U> void
forEach(Function<E,U> f)
          All collection methods can be built upon this forEach definition.
 Iterator<E> iterator()
           
 HashSet<E> remove(E value)
          Removes the specified value from the set if it exists.
 int size()
          Returns the size of the collection.
 
Methods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractSet
asSet, equals, hashCode
 
Methods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable
isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.github.andrewoma.dexx.collection.Traversable
isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet
 

Method Detail

factory

@NotNull
public static <E> BuilderFactory<E,HashSet<E>> factory()

empty

@NotNull
public static <E> HashSet<E> empty()

add

@NotNull
public HashSet<E> add(E value)
Description copied from interface: Set
Returns a set that adds the specified value if it doesn't already exist in this set.


remove

@NotNull
public HashSet<E> remove(E value)
Description copied from interface: Set
Removes the specified value from the set if it exists.


contains

public boolean contains(E value)
Description copied from interface: Set
Returns true if the value exists in this set.


size

public int size()
Description copied from interface: Traversable
Returns the size of the collection.

Warning: infinite collections are possible, as are collections that require traversal to calculate the size.

Specified by:
size in interface Traversable<E>
Overrides:
size in class AbstractTraversable<E>

forEach

public <U> void forEach(@NotNull
                        Function<E,U> f)
Description copied from interface: Traversable
All collection methods can be built upon this forEach definition.

Specified by:
forEach in interface Traversable<E>
Overrides:
forEach in class AbstractIterable<E>

iterator

@NotNull
public Iterator<E> iterator()


Copyright © 2014. All Rights Reserved.