org.javimmutable.collections
Interface JImmutableSet<T>

Type Parameters:
T -
All Superinterfaces:
Cursorable<T>, Insertable<T>, Iterable<T>
All Known Implementing Classes:
AbstractJImmutableSet, JImmutableHashSet, JImmutableInsertOrderSet, JImmutableTreeSet

@Immutable
public interface JImmutableSet<T>
extends Insertable<T>, Cursorable<T>, Iterable<T>

Interface for immutable sets.


Method Summary
 boolean contains(T value)
          Determines if the Set contains the specified value.
 boolean containsAll(Collection<? extends T> values)
          Determines if the Set contains all values in the specified collection.
 boolean containsAll(Cursor<? extends T> values)
          Determines if the Set contains all values in the specified collection.
 boolean containsAll(Cursorable<? extends T> values)
          Determines if the Set contains all values in the specified collection.
 boolean containsAll(Iterator<? extends T> values)
          Determines if the Set contains all values in the specified collection.
 boolean containsAny(Collection<? extends T> values)
          Determines if the Set contains any values in the specified collection.
 boolean containsAny(Cursor<? extends T> values)
          Determines if the Set contains any values in the specified collection.
 boolean containsAny(Cursorable<? extends T> values)
          Determines if the Set contains any values in the specified collection.
 boolean containsAny(Iterator<? extends T> values)
          Determines if the Set contains any values in the specified collection.
 JImmutableSet<T> delete(T value)
          Removes the value from the Set.
 JImmutableSet<T> deleteAll()
           
 JImmutableSet<T> deleteAll(Collection<? extends T> other)
          Removes all values of other from the Set.
 JImmutableSet<T> deleteAll(Cursor<? extends T> other)
          Removes all values of other from the Set.
 JImmutableSet<T> deleteAll(Cursorable<? extends T> other)
          Removes all values of other from the Set.
 JImmutableSet<T> deleteAll(Iterator<? extends T> other)
          Removes all values of other from the Set.
 Set<T> getSet()
           
 JImmutableSet<T> insert(T value)
          Adds the single value to the Set.
 JImmutableSet<T> intersection(Collection<? extends T> other)
          Removes all values from the Set that are not contained in the other collection.
 JImmutableSet<T> intersection(Cursor<? extends T> values)
          Removes all values from the Set that are not contained in the other collection.
 JImmutableSet<T> intersection(Cursorable<? extends T> other)
          Removes all values from the Set that are not contained in the other collection.
 JImmutableSet<T> intersection(Iterator<? extends T> values)
          Removes all values from the Set that are not contained in the other collection.
 JImmutableSet<T> intersection(JImmutableSet<T> other)
          Removes all values from the Set that are not contained in the other collection.
 JImmutableSet<T> intersection(Set<? extends T> other)
          Removes all values from the Set that are not contained in the other collection.
 boolean isEmpty()
           
 int size()
          Determines the number of values in the Set.
 JImmutableSet<T> union(Collection<? extends T> other)
          Adds all values from other to the Set.
 JImmutableSet<T> union(Cursor<? extends T> values)
          Adds all values from other to the Set.
 JImmutableSet<T> union(Cursorable<? extends T> other)
          Adds all values from other to the Set.
 JImmutableSet<T> union(Iterator<? extends T> values)
          Adds all values from other to the Set.
 
Methods inherited from interface org.javimmutable.collections.Cursorable
cursor
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

insert

@Nonnull
JImmutableSet<T> insert(@Nonnull
                                T value)
Adds the single value to the Set.

Specified by:
insert in interface Insertable<T>
Parameters:
value -
Returns:
instance of set containing the value

contains

boolean contains(@Nullable
                 T value)
Determines if the Set contains the specified value.

Parameters:
value -
Returns:
true if the Set contains the value

containsAll

boolean containsAll(@Nonnull
                    Cursorable<? extends T> values)
Determines if the Set contains all values in the specified collection.

Parameters:
values -
Returns:
true if the Set contains the values

containsAll

boolean containsAll(@Nonnull
                    Collection<? extends T> values)
Determines if the Set contains all values in the specified collection.

Parameters:
values -
Returns:
true if the Set contains the values

containsAll

boolean containsAll(@Nonnull
                    Cursor<? extends T> values)
Determines if the Set contains all values in the specified collection.

Parameters:
values -
Returns:
true if the Set contains the values

containsAll

boolean containsAll(@Nonnull
                    Iterator<? extends T> values)
Determines if the Set contains all values in the specified collection.

Parameters:
values -
Returns:
true if the Set contains the values

containsAny

boolean containsAny(@Nonnull
                    Cursorable<? extends T> values)
Determines if the Set contains any values in the specified collection.

Parameters:
values -
Returns:
true if the Set contains a value

containsAny

boolean containsAny(@Nonnull
                    Collection<? extends T> values)
Determines if the Set contains any values in the specified collection.

Parameters:
values -
Returns:
true if the Set contains a value

containsAny

boolean containsAny(@Nonnull
                    Cursor<? extends T> values)
Determines if the Set contains any values in the specified collection.

Parameters:
values -
Returns:
true if the Set contains a value

containsAny

boolean containsAny(@Nonnull
                    Iterator<? extends T> values)
Determines if the Set contains any values in the specified collection.

Parameters:
values -
Returns:
true if the Set contains a value

delete

@Nonnull
JImmutableSet<T> delete(T value)
Removes the value from the Set. Has no effect if the value is not in the Set.

Parameters:
value -
Returns:
instance of set without the value

deleteAll

@Nonnull
JImmutableSet<T> deleteAll(@Nonnull
                                   Cursorable<? extends T> other)
Removes all values of other from the Set. Has no effect if none of the values are in the Set

Parameters:
other -
Returns:
instance of set without the values

deleteAll

@Nonnull
JImmutableSet<T> deleteAll(@Nonnull
                                   Collection<? extends T> other)
Removes all values of other from the Set. Has no effect if none of the values are in the Set

Parameters:
other -
Returns:
instance of set without the values

deleteAll

@Nonnull
JImmutableSet<T> deleteAll(@Nonnull
                                   Cursor<? extends T> other)
Removes all values of other from the Set. Has no effect if none of the values are in the Set

Parameters:
other -
Returns:
instance of set without the values

deleteAll

@Nonnull
JImmutableSet<T> deleteAll(@Nonnull
                                   Iterator<? extends T> other)
Removes all values of other from the Set. Has no effect if none of the values are in the Set

Parameters:
other -
Returns:
instance of set without the values

union

@Nonnull
JImmutableSet<T> union(@Nonnull
                               Cursorable<? extends T> other)
Adds all values from other to the Set.

Parameters:
other - source of values to add
Returns:
instance of set containing the values

union

@Nonnull
JImmutableSet<T> union(@Nonnull
                               Collection<? extends T> other)
Adds all values from other to the Set.

Parameters:
other - source of values to add
Returns:
instance of set containing the values

union

@Nonnull
JImmutableSet<T> union(@Nonnull
                               Cursor<? extends T> values)
Adds all values from other to the Set.

Parameters:
values - source of values to add
Returns:
instance of set containing the values

union

@Nonnull
JImmutableSet<T> union(@Nonnull
                               Iterator<? extends T> values)
Adds all values from other to the Set.

Parameters:
values - source of values to add
Returns:
instance of set containing the values

intersection

@Nonnull
JImmutableSet<T> intersection(@Nonnull
                                      Cursorable<? extends T> other)
Removes all values from the Set that are not contained in the other collection.

Parameters:
other -
Returns:
instance of set with unmatched values removed

intersection

@Nonnull
JImmutableSet<T> intersection(@Nonnull
                                      Collection<? extends T> other)
Removes all values from the Set that are not contained in the other collection.

Parameters:
other -
Returns:
instance of set with unmatched values removed

intersection

@Nonnull
JImmutableSet<T> intersection(@Nonnull
                                      Cursor<? extends T> values)
Removes all values from the Set that are not contained in the other collection.

Parameters:
values -
Returns:
instance of set with unmatched values removed

intersection

@Nonnull
JImmutableSet<T> intersection(@Nonnull
                                      Iterator<? extends T> values)
Removes all values from the Set that are not contained in the other collection.

Parameters:
values -
Returns:
instance of set with unmatched values removed

intersection

@Nonnull
JImmutableSet<T> intersection(@Nonnull
                                      JImmutableSet<T> other)
Removes all values from the Set that are not contained in the other collection.

Parameters:
other -
Returns:
instance of set with unmatched values removed

intersection

@Nonnull
JImmutableSet<T> intersection(@Nonnull
                                      Set<? extends T> other)
Removes all values from the Set that are not contained in the other collection.

Parameters:
other -
Returns:
instance of set with unmatched values removed

size

int size()
Determines the number of values in the Set.

Returns:
number of values in the Set

isEmpty

boolean isEmpty()
Returns:
true only if set contains no values

deleteAll

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

getSet

@Nonnull
Set<T> getSet()
Returns:
an unmodifiable Set implementation backed by this set.


Copyright © 2014 Burton Computer Corporation. All rights reserved.