Package org.ametys.plugins.repository
Class ChainedAmetysObjectIterable<A extends AmetysObject>
- java.lang.Object
-
- org.ametys.plugins.repository.ChainedAmetysObjectIterable<A>
-
- Type Parameters:
A- the actual type ofAmetysObjects.
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<A>,AmetysObjectIterable<A>
public class ChainedAmetysObjectIterable<A extends AmetysObject> extends Object implements AmetysObjectIterable<A>
Implementation of aAmetysObjectIterablebased on a list of othersAmetysObjectIterable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classChainedAmetysObjectIterable.ChainedIterator
-
Field Summary
Fields Modifier and Type Field Description private List<AmetysObjectIterable<A>>_iterables(package private) long_sizeprivate boolean_sizeComputed
-
Constructor Summary
Constructors Constructor Description ChainedAmetysObjectIterable(List<AmetysObjectIterable<A>> iterables)Creates aChainedAmetysObjectIterable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private long_computeSize()voidclose()Close the associated resources.
AnAmetysObjectIterablemust NOT be closed if any of the containedAmetysObjectis still in use.longgetSize()Returns the number of elements in this iterable.AmetysObjectIterator<A>iterator()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.repository.AmetysObjectIterable
spliterator, stream
-
-
-
-
Field Detail
-
_size
long _size
-
_iterables
private List<AmetysObjectIterable<A extends AmetysObject>> _iterables
-
_sizeComputed
private boolean _sizeComputed
-
-
Constructor Detail
-
ChainedAmetysObjectIterable
public ChainedAmetysObjectIterable(List<AmetysObjectIterable<A>> iterables)
Creates aChainedAmetysObjectIterable.- Parameters:
iterables- a list ofAmetysObjectIterable.
-
-
Method Detail
-
getSize
public long getSize()
Description copied from interface:AmetysObjectIterableReturns the number of elements in this iterable. If this information is unavailable, returns -1.- Specified by:
getSizein interfaceAmetysObjectIterable<A extends AmetysObject>- Returns:
- a long
-
_computeSize
private long _computeSize()
-
iterator
public AmetysObjectIterator<A> iterator()
- Specified by:
iteratorin interfaceAmetysObjectIterable<A extends AmetysObject>- Specified by:
iteratorin interfaceIterable<A extends AmetysObject>
-
close
public void close()
Description copied from interface:AmetysObjectIterableClose the associated resources.
AnAmetysObjectIterablemust NOT be closed if any of the containedAmetysObjectis still in use.- Specified by:
closein interfaceAmetysObjectIterable<A extends AmetysObject>- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-