|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<T>
edu.rice.cs.plt.collect.AbstractPredicateSet<E>
edu.rice.cs.plt.collect.SingletonSet<E>
public class SingletonSet<E>
An immutable PredicateSet with a single element.
| Constructor Summary | |
|---|---|
SingletonSet(E elt)
|
|
| Method Summary | ||
|---|---|---|
boolean |
add(E o)
|
|
boolean |
addAll(java.util.Collection<? extends E> c)
|
|
void |
clear()
|
|
boolean |
contains(java.lang.Object o)
Test whether the set contains an object. |
|
static
|
factory()
|
|
boolean |
hasFixedSize()
true if this iterable is known to have a fixed size. |
|
boolean |
isEmpty()
Returns size(1) == 0. |
|
boolean |
isInfinite()
true if the iterable is known to have infinite size. |
|
boolean |
isStatic()
true if this iterable is unchanging. |
|
java.util.Iterator<E> |
iterator()
|
|
static
|
make(E element)
Call the constructor (allows E to be inferred) |
|
boolean |
remove(java.lang.Object o)
|
|
boolean |
removeAll(java.util.Collection<?> c)
|
|
boolean |
retainAll(java.util.Collection<?> c)
|
|
int |
size()
Returns size(Integer.MAX_VALUE). |
|
int |
size(int bound)
Computes the size by traversing the iterator (requires linear time). |
|
java.lang.Object[] |
toArray()
|
|
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
containsAll, equals, hashCode, toArray |
| Constructor Detail |
|---|
public SingletonSet(E elt)
| Method Detail |
|---|
public boolean contains(java.lang.Object o)
AbstractPredicateSetAbstractCollection.contains(java.lang.Object)) is a linear search,
which is almost always unreasonable for a set.
contains in interface Predicate<java.lang.Object>contains in interface java.util.Collection<E>contains in interface java.util.Set<E>contains in class AbstractPredicateSet<E>public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in interface java.util.Collection<E>iterator in interface java.util.Set<E>iterator in class java.util.AbstractCollection<E>public boolean isInfinite()
SizedIterabletrue if the iterable is known to have infinite size. If true, an iterator over the iterable in its
current state will never return false from hasNext().
isInfinite in interface SizedIterable<E>public boolean hasFixedSize()
SizedIterabletrue if this iterable is known to have a fixed size. This is the case if the iterable is immutable,
or if changes can only replace values, not remove or add them. An infinite iterable may be fixed if it
is guaranteed to never become finite.
hasFixedSize in interface SizedIterable<E>public boolean isStatic()
SizedIterabletrue if this iterable is unchanging. This implies that hasFixedSize() is true, and that
iterator() will always return the same (either == or equal() and immutable) elements
in the same order. ("Immutable" here means that equals() invocations are consistent over time -- if
two objects are equal, they will never become inequal, and vice versa.)
isStatic in interface SizedIterable<E>public int size()
AbstractPredicateSetsize(Integer.MAX_VALUE).
size in interface SizedIterable<E>size in interface java.util.Collection<E>size in interface java.util.Set<E>size in class AbstractPredicateSet<E>public int size(int bound)
AbstractPredicateSet
size in interface SizedIterable<E>size in class AbstractPredicateSet<E>bound - Maximum result. Assumed to be nonnegative.public boolean isEmpty()
AbstractPredicateSetsize(1) == 0.
isEmpty in interface SizedIterable<E>isEmpty in interface java.util.Collection<E>isEmpty in interface java.util.Set<E>isEmpty in class AbstractPredicateSet<E>public java.lang.Object[] toArray()
toArray in interface java.util.Collection<E>toArray in interface java.util.Set<E>toArray in class java.util.AbstractCollection<E>public boolean add(E o)
add in interface java.util.Collection<E>add in interface java.util.Set<E>add in class java.util.AbstractCollection<E>public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E>addAll in interface java.util.Set<E>addAll in class java.util.AbstractCollection<E>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<E>remove in interface java.util.Set<E>remove in class java.util.AbstractCollection<E>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<E>retainAll in interface java.util.Set<E>retainAll in class java.util.AbstractCollection<E>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<E>removeAll in interface java.util.Set<E>removeAll in class java.util.AbstractSet<E>public void clear()
clear in interface java.util.Collection<E>clear in interface java.util.Set<E>clear in class java.util.AbstractCollection<E>public static <E> SingletonSet<E> make(E element)
E to be inferred)
public static <T> Lambda<T,SingletonSet<T>> factory()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||