E - Type of enumerated elements.public final class CachedEnumerable<E> extends AbstractEnumerable<E>
Enumerable that caches the elements being enumerated.CacheEnumerator,
CachedElementWrapper| Modifier and Type | Field and Description |
|---|---|
(package private) static Consumer<?> |
noAction |
| Constructor and Description |
|---|
CachedEnumerable(Enumerable<E> source)
Constructs a
CachedEnumerable instance that caches the elements
of the given source Enumerable. |
CachedEnumerable(Enumerable<E> source,
long limit,
Consumer<CachedEnumerable<E>> onLimitCallback)
Constructs a
CachedEnumerable instance that caches the elements
of the given source Enumerable up to the given limit. |
| Modifier and Type | Method and Description |
|---|---|
CachedEnumerableState<E> |
disable()
Disables caching and returns the disabled state.
|
CachedEnumerableState<E> |
enable()
Enables caching and returns the enabled state.
|
protected Enumerator<E> |
internalEnumerator()
Yields a new
Enumerator for the current Enumerable. |
protected boolean |
internalOnceOnly()
Gets whether the current instance may yield a
Enumerator
only once. |
CachedEnumerableState<E> |
reset()
Resets the cache and returns the new state of the current
CachedEnumerable. |
CachedEnumerableState<E> |
resize(long newLimit)
Resizes the cache to a larger limit.
|
CachedEnumerableState<E> |
state()
Gets a
CachedEnumerableState instance representing the state
of the current CachedEnumerable. |
enumerating, enumerator, onceOnlyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappend, as, asEnumeration, asFiltered, asSpliterator, asStream, asTolerant, asTolerant, cached, cached, choiceOf, choiceOf, concat, concatOn, distinct, elementsEqual, empty, filter, flatMap, iterate, iterator, limit, limitWhile, map, map, of, of, of, of, of, of, ofLateBinding, ofLazyEnumeration, ofLazyIterable, ofLazyIterator, ofLazySpliterator, ofLazyStream, on, onceOnly, peek, prepend, prependOn, range, rangeClosed, rangeInt, rangeIntClosed, rangeLong, rangeLongClosed, repeat, repeatAll, repeatEach, reverse, skip, skipWhile, sorted, sorted, take, takeWhile, union, unionOn, zipAll, zipAny, zipBoth, zipLeft, zipRightforEach, spliteratorstatic final Consumer<?> noAction
CachedEnumerable(Enumerable<E> source)
CachedEnumerable instance that caches the elements
of the given source Enumerable.
The resulted CachedEnumerable has no size limit and it's internal
cache does not get replaced.
source - Enumerable to cache.CachedEnumerable(Enumerable<E> source, long limit, Consumer<CachedEnumerable<E>> onLimitCallback)
CachedEnumerable instance that caches the elements
of the given source Enumerable up to the given limit.source - Enumerable to cache.limit - maximum size of the internal cache.onLimitCallback - method to call when the cache reaches the limit.public CachedEnumerableState<E> state()
CachedEnumerableState instance representing the state
of the current CachedEnumerable.CachedEnumerableState instanceCachedEnumerable,
disable(),
enable(),
reset(),
resize(long)public CachedEnumerableState<E> disable()
CachedEnumerableState representing the disabled state.state(),
enable(),
reset(),
resize(long)public CachedEnumerableState<E> enable()
CachedEnumerableState representing the enabled state.state(),
disable(),
reset(),
resize(long)public CachedEnumerableState<E> reset()
CachedEnumerable.CachedEnumerableState representing the reset state.state(),
disable(),
enable(),
resize(long)public CachedEnumerableState<E> resize(long newLimit)
newLimit - larger cache size.CachedEnumerableState representing the resized state.state(),
disable(),
enable(),
reset()protected boolean internalOnceOnly()
AbstractEnumerableEnumerator
only once.
This method is the internal counterpart of AbstractEnumerable.onceOnly().
internalOnceOnly in class AbstractEnumerable<E>AbstractEnumerable.enumerator() may be called
only once, false otherwise.protected Enumerator<E> internalEnumerator()
AbstractEnumerableEnumerator for the current Enumerable.
This method is the internal counterpart of AbstractEnumerable.enumerator().
internalEnumerator in class AbstractEnumerable<E>Enumerator instance.EnumerableCopyright © 2016. All rights reserved.