public class ActionsList<T>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ActionsList.Evict<T> |
static interface |
ActionsList.Func1Count |
static interface |
ActionsList.Func1Element<T> |
static interface |
ActionsList.Func2 |
static interface |
ActionsList.Func3<T> |
static interface |
ActionsList.Replace<T> |
| Modifier and Type | Field and Description |
|---|---|
protected io.reactivex.Observable<java.util.List<T>> |
cache |
protected ActionsList.Evict<T> |
evict |
| Constructor and Description |
|---|
ActionsList(ActionsList.Evict<T> evict,
io.reactivex.Observable<java.util.List<T>> cache) |
| Modifier and Type | Method and Description |
|---|---|
ActionsList<T> |
add(ActionsList.Func2 func2,
T element)
Func2 will be called for every iteration until its condition returns true.
|
ActionsList<T> |
addAll(ActionsList.Func2 func2,
java.util.List<T> elements)
Func2 will be called for every iteration until its condition returns true.
|
ActionsList<T> |
addAllFirst(java.util.List<T> elements)
Add the objects at the first position of the cache.
|
ActionsList<T> |
addAllLast(java.util.List<T> elements)
Add the objects at the last position of the cache.
|
ActionsList<T> |
addFirst(T element)
Add the object at the first position of the cache.
|
ActionsList<T> |
addLast(T element)
Add the object at the last position of the cache.
|
ActionsList<T> |
evict(ActionsList.Func1Element<T> func1Element)
Func1Element will be called for every iteration until its condition returns true.
|
ActionsList<T> |
evict(ActionsList.Func3<T> func3)
Func3 will be called for every iteration until its condition returns true.
|
ActionsList<T> |
evictAll()
Evict all elements from the cache
|
ActionsList<T> |
evictAllKeepingFirstN(int n)
Evict elements from the cache starting from the first position until its count is equal to the
value specified in n param.
|
ActionsList<T> |
evictAllKeepingLastN(int n)
Evict elements from the cache starting from the last position until its count is equal to the
value specified in n param.
|
ActionsList<T> |
evictFirst()
Evict object at the first position of the cache
|
ActionsList<T> |
evictFirst(ActionsList.Func1Count func1Count)
Evict object at the first position of the cache.
|
ActionsList<T> |
evictFirstN(ActionsList.Func1Count func1Count,
int n)
Evict as much objects as requested by n param starting from the first position.
|
ActionsList<T> |
evictFirstN(int n)
Evict as much objects as requested by n param starting from the first position.
|
ActionsList<T> |
evictIterable(ActionsList.Func3<T> func3)
Func3 will be called for every iteration.
|
ActionsList<T> |
evictLast()
Evict object at the last position of the cache.
|
ActionsList<T> |
evictLast(ActionsList.Func1Count func1Count)
Evict object at the last position of the cache.
|
ActionsList<T> |
evictLastN(ActionsList.Func1Count func1Count,
int n)
Evict as much objects as requested by n param starting from the last position.
|
ActionsList<T> |
evictLastN(int n)
Evict as much objects as requested by n param starting from the last position.
|
io.reactivex.Observable<java.util.List<T>> |
toObservable() |
ActionsList<T> |
update(ActionsList.Func1Element<T> func1Element,
ActionsList.Replace<T> replace)
Func1Element will be called for every iteration until its condition returns true.
|
ActionsList<T> |
update(ActionsList.Func3<T> func3,
ActionsList.Replace<T> replace)
Func3 will be called for every iteration until its condition returns true.
|
ActionsList<T> |
updateIterable(ActionsList.Func1Element<T> func1Element,
ActionsList.Replace<T> replace)
Func1Element will be called for every.
|
ActionsList<T> |
updateIterable(ActionsList.Func3<T> func3,
ActionsList.Replace<T> replace)
Func3 will be called for every iteration.
|
static <T> ActionsList<T> |
with(ActionsList.Evict<T> evict,
io.reactivex.Observable<java.util.List<T>> cache)
Static accessor to create an instance of Actions in order follow the "builder" pattern.
|
protected io.reactivex.Observable<java.util.List<T>> cache
protected final ActionsList.Evict<T> evict
public ActionsList(ActionsList.Evict<T> evict, io.reactivex.Observable<java.util.List<T>> cache)
public static <T> ActionsList<T> with(ActionsList.Evict<T> evict, io.reactivex.Observable<java.util.List<T>> cache)
T - the type of the element of the list to be processed.evict - The implementation of Evict interface which allow to persists the changes.cache - An observable which is the result of calling the provider without evicting its
data.public ActionsList<T> add(ActionsList.Func2 func2, T element)
func2 - exposes the position of the current iteration and the count of elements in the
cache.element - the object to addOrUpdate to the cache.public ActionsList<T> addFirst(T element)
element - the object to addOrUpdate to the cache.public ActionsList<T> addLast(T element)
element - the object to addOrUpdate to the cache.public ActionsList<T> addAllFirst(java.util.List<T> elements)
elements - the objects to addOrUpdate to the cache.public ActionsList<T> addAllLast(java.util.List<T> elements)
elements - the objects to addOrUpdate to the cache.public ActionsList<T> addAll(ActionsList.Func2 func2, java.util.List<T> elements)
func2 - exposes the position of the current iteration and the count of elements in the
cache.elements - the objects to addOrUpdate to the cache.public ActionsList<T> evictFirst()
public ActionsList<T> evictFirstN(int n)
n - the amount of elements to evict.public ActionsList<T> evictLast()
public ActionsList<T> evictLastN(int n)
n - the amount of elements to evict.public ActionsList<T> evictFirst(ActionsList.Func1Count func1Count)
func1Count - exposes the count of elements in the cache.public ActionsList<T> evictFirstN(ActionsList.Func1Count func1Count, int n)
func1Count - exposes the count of elements in the cache.n - the amount of elements to evict.public ActionsList<T> evictLast(ActionsList.Func1Count func1Count)
func1Count - exposes the count of elements in the cache.public ActionsList<T> evictLastN(ActionsList.Func1Count func1Count, int n)
func1Count - exposes the count of elements in the cache.n - the amount of elements to evict.public ActionsList<T> evict(ActionsList.Func1Element<T> func1Element)
func1Element - exposes the element of the current iteration.public ActionsList<T> evict(ActionsList.Func3<T> func3)
func3 - exposes the position of the current iteration, the count of elements in the cache
and the element of the current iteration.public ActionsList<T> evictAll()
public ActionsList<T> evictAllKeepingFirstN(int n)
n - the amount of elements to keep from evict.public ActionsList<T> evictAllKeepingLastN(int n)
n - the amount of elements to keep from evict.public ActionsList<T> evictIterable(ActionsList.Func3<T> func3)
func3 - exposes the position of the current iteration, the count of elements in the cache
and the element of the current iteration.public ActionsList<T> update(ActionsList.Func1Element<T> func1Element, ActionsList.Replace<T> replace)
func1Element - exposes the element of the current iteration.replace - exposes the original element and expects back the one modified.public ActionsList<T> update(ActionsList.Func3<T> func3, ActionsList.Replace<T> replace)
func3 - exposes the position of the current iteration, the count of elements in the cache
and the element of the current iteration.replace - exposes the original element and expects back the one modified.public ActionsList<T> updateIterable(ActionsList.Func1Element<T> func1Element, ActionsList.Replace<T> replace)
func1Element - exposes the element of the current iteration.replace - exposes the original element and expects back the one modified.public ActionsList<T> updateIterable(ActionsList.Func3<T> func3, ActionsList.Replace<T> replace)
func3 - exposes the position of the current iteration, the count of elements in the cache
and the element of the current iteration.replace - exposes the original element and expects back the one modified.public io.reactivex.Observable<java.util.List<T>> toObservable()