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
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RedissonSubList(Codec codec, CommandAsyncExecutor commandExecutor, String name, int fromIndex, int toIndex)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, V element)
RFuture<Boolean>
addAllAsync(int index, Collection<? extends V> coll)
RFuture<Boolean>
addAllAsync(Collection<? extends V> c)
Adds all elements contained in the specified collectionRFuture<Boolean>
addAsync(V e)
Adds element into this collection.void
clear()
boolean
clearExpire()
Clear an expire timeout or expire date for object.RFuture<Boolean>
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.RFuture<Boolean>
containsAllAsync(Collection<?> c)
Returnstrue
if this collection contains all of the elements in the specified collection.boolean
equals(Object o)
boolean
expire(long timeToLive, TimeUnit timeUnit)
Set a timeout for object.RFuture<Boolean>
expireAsync(long timeToLive, TimeUnit timeUnit)
Set a timeout for object in async mode.boolean
expireAt(long timestamp)
Set an expire date for object.boolean
expireAt(Date timestamp)
Set an expire date for object.RFuture<Boolean>
expireAtAsync(long timestamp)
Set an expire date for object in async mode.RFuture<Boolean>
expireAtAsync(Date timestamp)
Set an expire date for object in async mode.void
fastSet(int index, V element)
Setelement
atindex
.RFuture<Void>
fastSetAsync(int index, V element)
Setelement
atindex
.V
get(int index)
RFuture<V>
getAsync(int index)
int
hashCode()
<R> RFuture<R>
indexOfAsync(Object o, Convertor<R> convertor)
RFuture<Integer>
lastIndexOfAsync(Object o)
ListIterator<V>
listIterator()
ListIterator<V>
listIterator(int fromIndex)
RFuture<List<V>>
readAllAsync()
Read all elements at oncelong
remainTimeToLive()
Remaining time to live of Redisson object that has a timeoutRFuture<Long>
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeoutV
remove(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.V
set(int index, V element)
RFuture<V>
setAsync(int index, V element)
RFuture<Integer>
sizeAsync()
Returns number of elements in this collection.RList<V>
subList(int fromIndex, int toIndex)
String
toString()
void
trim(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, contains, containsAll, containsAsync, fastRemove, fastRemoveAsync, get, getAsync, indexOf, indexOfAsync, isEmpty, iterator, lastIndexOf, lastIndexOfAsync, mapReduce, 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, retainAll, size, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, toArray, toArray
-
Methods inherited from class org.redisson.RedissonObject
await, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, 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, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RList
addAfter, addBefore, fastRemove, get, mapReduce, readAll, remove
-
Methods inherited from interface org.redisson.api.RListAsync
addAfterAsync, addAsync, addBeforeAsync, fastRemoveAsync, getAsync, indexOfAsync, removeAsync, removeAsync
-
Methods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, 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:RCollectionAsync
Returns number of elements in this collection.- Specified by:
sizeAsync
in interfaceRCollectionAsync<V>
- Overrides:
sizeAsync
in classRedissonList<V>
- Returns:
- size of collection
-
readAllAsync
public RFuture<List<V>> readAllAsync()
Description copied from interface:RListAsync
Read all elements at once- Specified by:
readAllAsync
in interfaceRListAsync<V>
- Overrides:
readAllAsync
in classRedissonList<V>
- Returns:
- list of values
-
addAsync
public RFuture<Boolean> addAsync(V e)
Description copied from interface:RCollectionAsync
Adds element into this collection.- Specified by:
addAsync
in interfaceRCollectionAsync<V>
- Overrides:
addAsync
in classRedissonList<V>
- Parameters:
e
- - element to add- Returns:
true
if an element was added andfalse
if it is already present
-
removeAsync
public RFuture<Boolean> removeAsync(Object o)
Description copied from interface:RCollectionAsync
Removes a single instance of the specified element from this collection, if it is present.- Specified by:
removeAsync
in interfaceRCollectionAsync<V>
- Overrides:
removeAsync
in classRedissonList<V>
- Parameters:
o
- element to be removed from this collection, if present- Returns:
true
if an element was removed as a result of this call
-
containsAllAsync
public RFuture<Boolean> containsAllAsync(Collection<?> c)
Description copied from interface:RCollectionAsync
Returnstrue
if this collection contains all of the elements in the specified collection.- Specified by:
containsAllAsync
in interfaceRCollectionAsync<V>
- Overrides:
containsAllAsync
in classRedissonList<V>
- Parameters:
c
- collection to be checked for containment in this collection- Returns:
true
if this collection contains all of the elements in the specified collection
-
addAllAsync
public RFuture<Boolean> addAllAsync(Collection<? extends V> c)
Description copied from interface:RCollectionAsync
Adds all elements contained in the specified collection- Specified by:
addAllAsync
in interfaceRCollectionAsync<V>
- Overrides:
addAllAsync
in classRedissonList<V>
- Parameters:
c
- - collection of elements to add- Returns:
true
if at least one element was added andfalse
if all elements are already present
-
addAllAsync
public RFuture<Boolean> addAllAsync(int index, Collection<? extends V> coll)
- Specified by:
addAllAsync
in interfaceRListAsync<V>
- Overrides:
addAllAsync
in classRedissonList<V>
-
removeAllAsync
public RFuture<Boolean> removeAllAsync(Collection<?> c)
Description copied from interface:RCollectionAsync
Removes all of this collection's elements that are also contained in the specified collection.- Specified by:
removeAllAsync
in interfaceRCollectionAsync<V>
- Overrides:
removeAllAsync
in classRedissonList<V>
- Parameters:
c
- collection containing elements to be removed from this collection- Returns:
true
if this collection changed as a result of the call
-
retainAllAsync
public RFuture<Boolean> retainAllAsync(Collection<?> c)
Description copied from interface:RCollectionAsync
Retains only the elements in this collection that are contained in the specified collection.- Specified by:
retainAllAsync
in interfaceRCollectionAsync<V>
- Overrides:
retainAllAsync
in classRedissonList<V>
- Parameters:
c
- collection containing elements to be retained in this collection- Returns:
true
if this collection changed as a result of the call
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<V>
- Specified by:
clear
in interfaceList<V>
- Overrides:
clear
in classRedissonList<V>
-
getAsync
public RFuture<V> getAsync(int index)
- Specified by:
getAsync
in interfaceRListAsync<V>
- Overrides:
getAsync
in classRedissonList<V>
-
get
public V get(int index)
-
setAsync
public RFuture<V> setAsync(int index, V element)
- Specified by:
setAsync
in interfaceRListAsync<V>
- Overrides:
setAsync
in classRedissonList<V>
-
fastSetAsync
public RFuture<Void> fastSetAsync(int index, V element)
Description copied from interface:RListAsync
Setelement
atindex
. Works faster thanRListAsync.setAsync(int, Object)
but doesn't return previous element.- Specified by:
fastSetAsync
in interfaceRListAsync<V>
- Overrides:
fastSetAsync
in 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:
indexOfAsync
in classRedissonList<V>
-
lastIndexOfAsync
public RFuture<Integer> lastIndexOfAsync(Object o)
- Specified by:
lastIndexOfAsync
in interfaceRListAsync<V>
- Overrides:
lastIndexOfAsync
in classRedissonList<V>
-
listIterator
public ListIterator<V> listIterator()
- Specified by:
listIterator
in interfaceList<V>
- Overrides:
listIterator
in classRedissonList<V>
-
listIterator
public ListIterator<V> listIterator(int fromIndex)
- Specified by:
listIterator
in interfaceList<V>
- Overrides:
listIterator
in classRedissonList<V>
-
trimAsync
public RFuture<Void> trimAsync(int fromIndex, int toIndex)
Description copied from interface:RListAsync
Trim list and remains elements only in specified rangefromIndex
, inclusive, andtoIndex
, inclusive.- Specified by:
trimAsync
in interfaceRListAsync<V>
- Overrides:
trimAsync
in classRedissonList<V>
- Parameters:
fromIndex
- - from indextoIndex
- - to index- Returns:
- void
-
trim
public void trim(int fromIndex, int toIndex)
Description copied from interface:RList
Trim list and remains elements only in specified rangefromIndex
, inclusive, andtoIndex
, inclusive.
-
toString
public String toString()
- Overrides:
toString
in classRedissonList<V>
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceCollection<V>
- Specified by:
equals
in interfaceList<V>
- Overrides:
equals
in classRedissonList<V>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<V>
- Specified by:
hashCode
in interfaceList<V>
- Overrides:
hashCode
in classRedissonList<V>
-
expire
public boolean expire(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirable
Set a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirableAsync
Set a timeout for object in async mode. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(long timestamp)
Description copied from interface:RExpirable
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(long timestamp)
Description copied from interface:RExpirableAsync
Set an expire date for object in async mode. When expire date comes the key will automatically be deleted.- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(Date timestamp)
Description copied from interface:RExpirable
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(Date timestamp)
Description copied from interface:RExpirableAsync
Set an expire date for object in async mode. When expire date comes the key will automatically be deleted.- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
clearExpire
public boolean clearExpire()
Description copied from interface:RExpirable
Clear an expire timeout or expire date for object.- Specified by:
clearExpire
in interfaceRExpirable
- Returns:
true
if timeout was removedfalse
if object does not exist or does not have an associated timeout
-
clearExpireAsync
public RFuture<Boolean> clearExpireAsync()
Description copied from interface:RExpirableAsync
Clear an expire timeout or expire date for object in async mode. Object will not be deleted.- Specified by:
clearExpireAsync
in interfaceRExpirableAsync
- Returns:
true
if the timeout was cleared andfalse
if not
-
remainTimeToLive
public long remainTimeToLive()
Description copied from interface:RExpirable
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLive
in 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:RExpirableAsync
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLiveAsync
in interfaceRExpirableAsync
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
-