Package org.redisson
Class RedissonSubList<V>
- java.lang.Object
-
- org.redisson.RedissonObject
-
- org.redisson.RedissonList<V>
-
- org.redisson.RedissonSubList<V>
-
- Type Parameters:
V- the type of elements held in this collection
- All Implemented Interfaces:
Iterable<V>,Collection<V>,List<V>,RandomAccess,RCollectionAsync<V>,RExpirable,RExpirableAsync,RList<V>,RListAsync<V>,RObject,RObjectAsync,RSortable<List<V>>,RSortableAsync<List<V>>
public class RedissonSubList<V> extends RedissonList<V> implements RList<V>
Distributed and concurrent implementation ofList- Author:
- Nikita Koksharov
-
-
Field Summary
-
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRedissonSubList(Codec codec, CommandAsyncExecutor commandExecutor, String name, int fromIndex, int toIndex)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, V element)RFuture<Boolean>addAllAsync(int index, Collection<? extends V> coll)Insertselementsatindex.RFuture<Boolean>addAllAsync(Collection<? extends V> c)Adds all elements contained in the specified collectionRFuture<Boolean>addAsync(V e)Adds element into this collection.voidclear()booleanclearExpire()Clear an expire timeout or expire date for object.RFuture<Boolean>clearExpireAsync()Clear an expire timeout or expire date for object in async mode.protected RFuture<Boolean>clearExpireAsync(String... keys)RFuture<Boolean>containsAllAsync(Collection<?> c)Returnstrueif this collection contains all of the elements in the specified collection.booleanequals(Object o)booleanexpire(long timeToLive, TimeUnit timeUnit)Set a timeout for object.booleanexpire(Instant instant)Set an expire date for object.RFuture<Boolean>expireAsync(long timeToLive, TimeUnit timeUnit)Set a timeout for object in async mode.protected RFuture<Boolean>expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)RFuture<Boolean>expireAsync(Instant instant)Set an expire date for object.booleanexpireAt(long timestamp)UseRExpirable.expire(Instant)insteadbooleanexpireAt(Date timestamp)UseRExpirable.expire(Instant)insteadRFuture<Boolean>expireAtAsync(long timestamp)UseRExpirableAsync.expireAsync(Instant)insteadprotected RFuture<Boolean>expireAtAsync(long timestamp, String... keys)RFuture<Boolean>expireAtAsync(Date timestamp)UseRExpirableAsync.expireAsync(Instant)insteadvoidfastSet(int index, V element)Setelementatindex.RFuture<Void>fastSetAsync(int index, V element)Setelementatindex.Vget(int index)RFuture<V>getAsync(int index)Get element atindexinthashCode()<R> RFuture<R>indexOfAsync(Object o, Convertor<R> convertor)RFuture<Integer>lastIndexOfAsync(Object o)Returns last index ofelementor -1 if element isn't foundListIterator<V>listIterator()ListIterator<V>listIterator(int fromIndex)RFuture<List<V>>readAllAsync()Read all elements at oncelongremainTimeToLive()Remaining time to live of Redisson object that has a timeoutRFuture<Long>remainTimeToLiveAsync()Remaining time to live of Redisson object that has a timeoutVremove(int index)RFuture<Boolean>removeAllAsync(Collection<?> c)Removes all of this collection's elements that are also contained in the specified collection.RFuture<Boolean>removeAsync(Object o)Removes a single instance of the specified element from this collection, if it is present.RFuture<Boolean>retainAllAsync(Collection<?> c)Retains only the elements in this collection that are contained in the specified collection.Vset(int index, V element)RFuture<V>setAsync(int index, V element)Setelementatindexand returns previous element.RFuture<Integer>sizeAsync()Returns number of elements in this collection.RList<V>subList(int fromIndex, int toIndex)StringtoString()voidtrim(int fromIndex, int toIndex)Trim list and remains elements only in specified rangefromIndex, inclusive, andtoIndex, inclusive.RFuture<Void>trimAsync(int fromIndex, int toIndex)Trim list and remains elements only in specified rangefromIndex, inclusive, andtoIndex, inclusive.-
Methods inherited from class org.redisson.RedissonList
add, addAfter, addAfterAsync, addAll, addAll, addAsync, addAsync, addBefore, addBeforeAsync, addListener, addListenerAsync, contains, containsAll, containsAsync, fastRemove, fastRemoveAsync, get, getAsync, indexOf, indexOfAsync, isEmpty, iterator, lastIndexOf, lastIndexOfAsync, mapReduce, range, range, rangeAsync, rangeAsync, readAll, readSort, readSort, readSort, readSort, readSort, readSort, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, remove, remove, removeAll, removeAsync, removeAsync, removeIf, removeListener, removeListenerAsync, retainAll, size, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, toArray, toArray
-
Methods inherited from class org.redisson.RedissonObject
addListener, addListenerAsync, copy, copyAsync, delete, deleteAsync, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListenersAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
add, addAll, addAll, contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, remove, removeAll, replaceAll, retainAll, size, sort, spliterator, toArray, toArray
-
Methods inherited from interface org.redisson.api.RCollectionAsync
containsAsync
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RList
addAfter, addBefore, addListener, fastRemove, get, mapReduce, range, range, readAll, remove
-
Methods inherited from interface org.redisson.api.RListAsync
addAfterAsync, addAsync, addBeforeAsync, addListenerAsync, fastRemoveAsync, getAsync, indexOfAsync, rangeAsync, rangeAsync, removeAsync, removeAsync
-
Methods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Methods inherited from interface org.redisson.api.RSortable
readSort, readSort, readSort, readSort, readSort, readSort, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo
-
Methods inherited from interface org.redisson.api.RSortableAsync
readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync
-
-
-
-
Constructor Detail
-
RedissonSubList
protected RedissonSubList(Codec codec, CommandAsyncExecutor commandExecutor, String name, int fromIndex, int toIndex)
-
-
Method Detail
-
sizeAsync
public RFuture<Integer> sizeAsync()
Description copied from interface:RCollectionAsyncReturns number of elements in this collection.- Specified by:
sizeAsyncin interfaceRCollectionAsync<V>- Overrides:
sizeAsyncin classRedissonList<V>- Returns:
- size of collection
-
readAllAsync
public RFuture<List<V>> readAllAsync()
Description copied from interface:RListAsyncRead all elements at once- Specified by:
readAllAsyncin interfaceRListAsync<V>- Overrides:
readAllAsyncin classRedissonList<V>- Returns:
- list of values
-
addAsync
public RFuture<Boolean> addAsync(V e)
Description copied from interface:RCollectionAsyncAdds element into this collection.- Specified by:
addAsyncin interfaceRCollectionAsync<V>- Overrides:
addAsyncin classRedissonList<V>- Parameters:
e- - element to add- Returns:
trueif an element was added andfalseif it is already present
-
removeAsync
public RFuture<Boolean> removeAsync(Object o)
Description copied from interface:RCollectionAsyncRemoves a single instance of the specified element from this collection, if it is present.- Specified by:
removeAsyncin interfaceRCollectionAsync<V>- Overrides:
removeAsyncin classRedissonList<V>- Parameters:
o- element to be removed from this collection, if present- Returns:
trueif an element was removed as a result of this call
-
containsAllAsync
public RFuture<Boolean> containsAllAsync(Collection<?> c)
Description copied from interface:RCollectionAsyncReturnstrueif this collection contains all of the elements in the specified collection.- Specified by:
containsAllAsyncin interfaceRCollectionAsync<V>- Overrides:
containsAllAsyncin classRedissonList<V>- Parameters:
c- collection to be checked for containment in this collection- Returns:
trueif this collection contains all of the elements in the specified collection
-
addAllAsync
public RFuture<Boolean> addAllAsync(Collection<? extends V> c)
Description copied from interface:RCollectionAsyncAdds all elements contained in the specified collection- Specified by:
addAllAsyncin interfaceRCollectionAsync<V>- Overrides:
addAllAsyncin classRedissonList<V>- Parameters:
c- - collection of elements to add- Returns:
trueif at least one element was added andfalseif all elements are already present
-
addAllAsync
public RFuture<Boolean> addAllAsync(int index, Collection<? extends V> coll)
Description copied from interface:RListAsyncInsertselementsatindex. Subsequent elements are shifted.- Specified by:
addAllAsyncin interfaceRListAsync<V>- Overrides:
addAllAsyncin classRedissonList<V>- Parameters:
index- - index numbercoll- - elements to insert- Returns:
trueif list changed orfalseif element isn't found
-
removeAllAsync
public RFuture<Boolean> removeAllAsync(Collection<?> c)
Description copied from interface:RCollectionAsyncRemoves all of this collection's elements that are also contained in the specified collection.- Specified by:
removeAllAsyncin interfaceRCollectionAsync<V>- Overrides:
removeAllAsyncin classRedissonList<V>- Parameters:
c- collection containing elements to be removed from this collection- Returns:
trueif this collection changed as a result of the call
-
retainAllAsync
public RFuture<Boolean> retainAllAsync(Collection<?> c)
Description copied from interface:RCollectionAsyncRetains only the elements in this collection that are contained in the specified collection.- Specified by:
retainAllAsyncin interfaceRCollectionAsync<V>- Overrides:
retainAllAsyncin classRedissonList<V>- Parameters:
c- collection containing elements to be retained in this collection- Returns:
trueif this collection changed as a result of the call
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<V>- Specified by:
clearin interfaceList<V>- Overrides:
clearin classRedissonList<V>
-
getAsync
public RFuture<V> getAsync(int index)
Description copied from interface:RListAsyncGet element atindex- Specified by:
getAsyncin interfaceRListAsync<V>- Overrides:
getAsyncin classRedissonList<V>- Parameters:
index- - index of object- Returns:
- element
-
get
public V get(int index)
-
setAsync
public RFuture<V> setAsync(int index, V element)
Description copied from interface:RListAsyncSetelementatindexand returns previous element.- Specified by:
setAsyncin interfaceRListAsync<V>- Overrides:
setAsyncin classRedissonList<V>- Parameters:
index- - index of objectelement- - object- Returns:
- previous element or
nullif element wasn't set.
-
fastSetAsync
public RFuture<Void> fastSetAsync(int index, V element)
Description copied from interface:RListAsyncSetelementatindex. Works faster thanRListAsync.setAsync(int, Object)but doesn't return previous element.- Specified by:
fastSetAsyncin interfaceRListAsync<V>- Overrides:
fastSetAsyncin classRedissonList<V>- Parameters:
index- - index of objectelement- - object- Returns:
- void
-
add
public void add(int index, V element)
-
remove
public V remove(int index)
-
indexOfAsync
public <R> RFuture<R> indexOfAsync(Object o, Convertor<R> convertor)
- Overrides:
indexOfAsyncin classRedissonList<V>
-
lastIndexOfAsync
public RFuture<Integer> lastIndexOfAsync(Object o)
Description copied from interface:RListAsyncReturns last index ofelementor -1 if element isn't found- Specified by:
lastIndexOfAsyncin interfaceRListAsync<V>- Overrides:
lastIndexOfAsyncin classRedissonList<V>- Parameters:
o- to find- Returns:
- index of -1 if element isn't found
-
listIterator
public ListIterator<V> listIterator()
- Specified by:
listIteratorin interfaceList<V>- Overrides:
listIteratorin classRedissonList<V>
-
listIterator
public ListIterator<V> listIterator(int fromIndex)
- Specified by:
listIteratorin interfaceList<V>- Overrides:
listIteratorin classRedissonList<V>
-
trimAsync
public RFuture<Void> trimAsync(int fromIndex, int toIndex)
Description copied from interface:RListAsyncTrim list and remains elements only in specified rangefromIndex, inclusive, andtoIndex, inclusive.- Specified by:
trimAsyncin interfaceRListAsync<V>- Overrides:
trimAsyncin classRedissonList<V>- Parameters:
fromIndex- - from indextoIndex- - to index- Returns:
- void
-
trim
public void trim(int fromIndex, int toIndex)Description copied from interface:RListTrim list and remains elements only in specified rangefromIndex, inclusive, andtoIndex, inclusive.
-
toString
public String toString()
- Overrides:
toStringin classRedissonList<V>
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceCollection<V>- Specified by:
equalsin interfaceList<V>- Overrides:
equalsin classRedissonList<V>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<V>- Specified by:
hashCodein interfaceList<V>- Overrides:
hashCodein classRedissonList<V>
-
expire
public boolean expire(long timeToLive, TimeUnit timeUnit)Description copied from interface:RExpirableSet a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expirein interfaceRExpirable- Parameters:
timeToLive- - timeout before object will be deletedtimeUnit- - timeout time unit- Returns:
trueif the timeout was set andfalseif not
-
expireAsync
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirableAsyncSet a timeout for object in async mode. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsyncin interfaceRExpirableAsync- Parameters:
timeToLive- - timeout before object will be deletedtimeUnit- - timeout time unit- Returns:
trueif the timeout was set andfalseif not
-
expireAt
public boolean expireAt(long timestamp)
Description copied from interface:RExpirableUseRExpirable.expire(Instant)instead- Specified by:
expireAtin interfaceRExpirable- Parameters:
timestamp- - expire date in milliseconds (Unix timestamp)- Returns:
trueif the timeout was set andfalseif not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(long timestamp)
Description copied from interface:RExpirableAsyncUseRExpirableAsync.expireAsync(Instant)instead- Specified by:
expireAtAsyncin interfaceRExpirableAsync- Parameters:
timestamp- - expire date in milliseconds (Unix timestamp)- Returns:
trueif the timeout was set andfalseif not
-
expire
public boolean expire(Instant instant)
Description copied from interface:RExpirableSet an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expirein interfaceRExpirable- Parameters:
instant- - expire date- Returns:
trueif the timeout was set andfalseif not
-
expireAsync
public RFuture<Boolean> expireAsync(Instant instant)
Description copied from interface:RExpirableAsyncSet an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAsyncin interfaceRExpirableAsync- Parameters:
instant- - expire date- Returns:
trueif the timeout was set andfalseif not
-
expireAt
public boolean expireAt(Date timestamp)
Description copied from interface:RExpirableUseRExpirable.expire(Instant)instead- Specified by:
expireAtin interfaceRExpirable- Parameters:
timestamp- - expire date- Returns:
trueif the timeout was set andfalseif not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(Date timestamp)
Description copied from interface:RExpirableAsyncUseRExpirableAsync.expireAsync(Instant)instead- Specified by:
expireAtAsyncin interfaceRExpirableAsync- Parameters:
timestamp- - expire date- Returns:
trueif the timeout was set andfalseif not
-
clearExpire
public boolean clearExpire()
Description copied from interface:RExpirableClear an expire timeout or expire date for object.- Specified by:
clearExpirein interfaceRExpirable- Returns:
trueif timeout was removedfalseif object does not exist or does not have an associated timeout
-
clearExpireAsync
public RFuture<Boolean> clearExpireAsync()
Description copied from interface:RExpirableAsyncClear an expire timeout or expire date for object in async mode. Object will not be deleted.- Specified by:
clearExpireAsyncin interfaceRExpirableAsync- Returns:
trueif the timeout was cleared andfalseif not
-
remainTimeToLive
public long remainTimeToLive()
Description copied from interface:RExpirableRemaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLivein interfaceRExpirable- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
remainTimeToLiveAsync
public RFuture<Long> remainTimeToLiveAsync()
Description copied from interface:RExpirableAsyncRemaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLiveAsyncin interfaceRExpirableAsync- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
expireAsync
protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
-
-