E - the type of the elements in this setpublic class LazySetIntersection<E> extends AbstractSet<E>
Set view for common elements of two sets. The
intersection is backed by the input sets, so changes to any of the sets are
reflected in the intersection. The main purpose of the class is to facilitate
iteration over intersection of sets without computing the intersection
explicitly. Iteration over the intersection is organized by iterating over
the elements in the smallest set and checking if the elements are present in
the other set. An element is contained in the intersection as reported by
contains if it is contained in all input sets. The size of the
intersection reported by size is the minimum of the sizes for the
sets. This way it is possible to use the result to build other
LazySetIntersection and LazySetUnion objects. If any of the
sets is modified while an iteration over the intersection is in progress, the
results of the iteration are undefined. The set intersection does not support
additions or removal of elements; if attempted, an
UnsupportedOperationException will be thrown.LazySetUnion| Constructor and Description |
|---|
LazySetIntersection(Set<? extends E> firstSet,
Set<? extends E> secondSet)
Returns a new
Set view for intersection of two input sets. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Object o) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
boolean |
remove(Object o) |
int |
size() |
equals, hashCode, removeAlladd, addAll, clear, containsAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, addAll, clear, containsAll, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streampublic boolean contains(Object o)
contains in interface Collection<E>contains in interface Set<E>contains in class AbstractCollection<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface Set<E>remove in class AbstractCollection<E>public int size()
size in interface Collection<E>size in interface Set<E>size in class AbstractCollection<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface Set<E>isEmpty in class AbstractCollection<E>Copyright © 2011–2024 Live Ontologies Project. All rights reserved.