public interface FSet<Elt> extends Set<Elt>
Although this interface extends Set
of the Java Collections Framework,
and thus is somewhat integrated into that framework, it is not used the same way
as the java.util
classes that implement Set
. It does
not support the update operators declared by Set
(which are
documented as optional, anyway); in their place it adds several new operators
which are functional, in the sense that rather than modifying the set in place,
they construct and return a new set.
Modifier and Type  Method and Description 

boolean 
add(Elt e)
Deprecated.

boolean 
addAll(Collection<? extends Elt> c)
Deprecated.

Elt 
arb()
Returns an arbitrary element of the set, if the set is nonempty.

void 
clear()
Deprecated.

FSet<Elt> 
difference(Collection<? extends Elt> coll)
Returns the difference of this set less
coll . 
FSet<Elt> 
intersection(Collection<? extends Elt> coll)
Returns the intersection of this set with
coll . 
boolean 
isSubset(Collection<?> coll)
Returns true if this set is a subset of
coll . 
boolean 
isSuperset(Collection<?> coll)
Returns true if this set is a superset of
coll . 
FSet<Elt> 
less(Elt elt)
Removes
elt , returning a (possibly) new set. 
boolean 
remove(Object e)
Deprecated.

boolean 
removeAll(Collection<?> c)
Deprecated.

boolean 
retainAll(Collection<?> c)
Deprecated.

FSet<Elt> 
union(Collection<? extends Elt> coll)
Returns the union of this set with
coll . 
FSet<Elt> 
with(Elt elt)
Adds
elt , returning a (possibly) new set. 
Elt arb()
NoSuchElementException
 if the set is emptyFSet<Elt> with(Elt elt)
elt
, returning a (possibly) new set. More formally, if the
set already contains an element e
such that (elt == null ?
e == null : elt.equals(e)), returns this
or a set equal to it;
otherwise returns a new set containing elt
as well as all the
elements of this set.
 Parameters:
elt
 element to be added to the set
 Returns:
 the possibly updated set
 Throws:
ClassCastException
 if the class of elt
is incompatible
with the set
NullPointerException
 if elt
is null and this set does
not support null elements
IllegalArgumentException
 if some aspect of elt
makes it
incompatible with the set

less
FSet<Elt> less(Elt elt)
Removes elt
, returning a (possibly) new set. More formally, if
the set does not already contain an element e
such that
(elt == null ? e == null : elt.equals(e))
, returns
this
or a set equal to it; otherwise returns a new set
containing all elements of this set except e
.
 Parameters:
elt
 element to be removed from the set
 Returns:
 the possibly updated set
 Throws:
ClassCastException
 if the class of elt
is incompatible
with the set
NullPointerException
 if elt
is null and this set does
not support null elements
IllegalArgumentException
 if some aspect of elt
makes it
incompatible with the set

union
FSet<Elt> union(Collection<? extends Elt> coll)
Returns the union of this set with coll
. That is, returns a set
containing all elements that are in either this set, or coll
, or
both. The returned set is of the same class as this set and uses the same
ordering.
 Parameters:
coll
 the set to take the union with
 Returns:
 the union of the two sets
 Throws:
ClassCastException
 if coll
contains elements whose class is
incompatible with this set or its Comparator

intersection
FSet<Elt> intersection(Collection<? extends Elt> coll)
Returns the intersection of this set with coll
. That is, returns a
set containing all elements that are in both this set and coll
.
The returned set is of the same class as this set and uses the same ordering.
 Parameters:
coll
 the set to take the intersection with
 Returns:
 the intersection of the two sets
 Throws:
ClassCastException
 if elements of this set are incompatible with
coll
or its comparator, or conversely

difference
FSet<Elt> difference(Collection<? extends Elt> coll)
Returns the difference of this set less coll
. That is, returns a
set containing all elements that are in this set and not in coll
.
The returned set is of the same class as this set and uses the same ordering.
 Parameters:
coll
 the set to take the difference with
 Returns:
 the difference of the two sets (this set less
coll
)
 Throws:
ClassCastException
 if elements of this set are incompatible with
coll
or its comparator, or conversely

isSubset
boolean isSubset(Collection<?> coll)
Returns true if this set is a subset of coll
. That is, returns
true if coll
contains all elements of this set. The inclusion need
not be proper; that is, this method returns true if the two sets are equal.
 Parameters:
coll
 the collection to compare against
 Returns:
 whether this set is a subset of
coll
 Throws:
ClassCastException
 if elements of this set are incompatible with
coll
or its comparator, or conversely

isSuperset
boolean isSuperset(Collection<?> coll)
Returns true if this set is a superset of coll
. That is, returns
true if this set contains all elements of coll
. The inclusion need
not be proper; that is, this method returns true if the two sets are equal.
(Synonym for containsAll
.)
 Parameters:
coll
 the collection to compare against
 Returns:
 whether this set is a superset of
coll
 Throws:
ClassCastException
 if elements of this set are incompatible with
coll
or its comparator, or conversely

add
@Deprecated
boolean add(Elt e)
Deprecated.

addAll
@Deprecated
boolean addAll(Collection<? extends Elt> c)
Deprecated.

clear
@Deprecated
void clear()
Deprecated.

remove
@Deprecated
boolean remove(Object e)
Deprecated.

removeAll
@Deprecated
boolean removeAll(Collection<?> c)
Deprecated.

retainAll
@Deprecated
boolean retainAll(Collection<?> c)
Deprecated.