org.javimmutable.collections.inorder
Class JImmutableInsertOrderSet<T>

java.lang.Object
  extended by org.javimmutable.collections.common.AbstractJImmutableSet<T>
      extended by org.javimmutable.collections.inorder.JImmutableInsertOrderSet<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterable<T>, Cursorable<T>, Insertable<T>, JImmutableSet<T>

@Immutable
public class JImmutableInsertOrderSet<T>
extends AbstractJImmutableSet<T>

JImmutableSet implementation built on top of a JImmutableInsertOrderMap. During iteration elements are returned in the same order they were inserted into the set. Performance is slower than hash or tree sets but should be sufficient or most algorithms where insert order matters.


Method Summary
protected  JImmutableSet<T> create(JImmutableMap<T,Boolean> map)
          Implemented by derived classes to create a new instance of the appropriate class.
 JImmutableSet<T> deleteAll()
           
protected  JImmutableMap<T,Boolean> emptyMap()
          Implemented by derived classes to create a new empty PersistentMap for use by retainAll()
static
<T> JImmutableInsertOrderSet<T>
of()
           
 
Methods inherited from class org.javimmutable.collections.common.AbstractJImmutableSet
contains, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, containsAny, cursor, delete, deleteAll, deleteAll, deleteAll, deleteAll, equals, getSet, hashCode, insert, intersection, intersection, intersection, intersection, intersection, intersection, isEmpty, iterator, size, toString, union, union, union, union
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

of

public static <T> JImmutableInsertOrderSet<T> of()

deleteAll

@Nonnull
public JImmutableSet<T> deleteAll()
Returns:
an equivalent collection with no values

create

protected JImmutableSet<T> create(JImmutableMap<T,Boolean> map)
Description copied from class: AbstractJImmutableSet
Implemented by derived classes to create a new instance of the appropriate class.

Specified by:
create in class AbstractJImmutableSet<T>
Returns:

emptyMap

protected JImmutableMap<T,Boolean> emptyMap()
Description copied from class: AbstractJImmutableSet
Implemented by derived classes to create a new empty PersistentMap for use by retainAll()

Specified by:
emptyMap in class AbstractJImmutableSet<T>
Returns:


Copyright © 2014 Burton Computer Corporation. All rights reserved.