A
- the actual type of AmetysObject
s.public class CollatingUniqueAmetysObjectIterable<A extends AmetysObject> extends Object implements AmetysObjectIterable<A>
AmetysObjectIterable
based on a list of others AmetysObjectIterable
,
which returns the objects in a given order, removing duplicates.
Each iterable must be sorted.
The "collating" part is copied and adapted from Apache Commons Lang's CollatingIterator class.Modifier and Type | Class and Description |
---|---|
(package private) class |
CollatingUniqueAmetysObjectIterable.CollatingIterator |
Modifier and Type | Field and Description |
---|---|
(package private) Comparator<A> |
_comparator
The
Comparator used to evaluate order. |
private List<AmetysObjectIterable<A>> |
_iterables
The list of iterables.
|
Constructor and Description |
---|
CollatingUniqueAmetysObjectIterable(List<AmetysObjectIterable<A>> iterables,
Comparator<A> comparator)
Creates a
CollatingUniqueAmetysObjectIterable . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the associated resources.
An AmetysObjectIterable must NOT be closed if any of the contained AmetysObject is still in use. |
long |
getSize()
Returns the number of elements only if there is only one
AmetysObjectIterable in the list. |
AmetysObjectIterator<A> |
iterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
spliterator, stream
Comparator<A extends AmetysObject> _comparator
Comparator
used to evaluate order.private List<AmetysObjectIterable<A extends AmetysObject>> _iterables
public CollatingUniqueAmetysObjectIterable(List<AmetysObjectIterable<A>> iterables, Comparator<A> comparator)
CollatingUniqueAmetysObjectIterable
.iterables
- a list of AmetysObjectIterable
.comparator
- a comparator.public long getSize()
AmetysObjectIterable
in the list.
If there is more than 1 AmetysObjectIterable
, this always returns -1.getSize
in interface AmetysObjectIterable<A extends AmetysObject>
public AmetysObjectIterator<A> iterator()
iterator
in interface Iterable<A extends AmetysObject>
iterator
in interface AmetysObjectIterable<A extends AmetysObject>
public void close()
AmetysObjectIterable
AmetysObjectIterable
must NOT be closed if any of the contained AmetysObject
is still in use.close
in interface Closeable
close
in interface AutoCloseable
close
in interface AmetysObjectIterable<A extends AmetysObject>