Package org.redisson

Class BaseRedissonList<V>

java.lang.Object
org.redisson.RedissonObject
org.redisson.BaseRedissonList<V>
Type Parameters:
V - the type of elements held in this collection
All Implemented Interfaces:
RExpirable, RExpirableAsync, RObject, RObjectAsync
Direct Known Subclasses:
RedissonList, RedissonPriorityQueue, RedissonQueue

public class BaseRedissonList<V> extends RedissonObject
Base list implementation
Author:
Nikita Koksharov
  • Method Details

    • mapReduce

      public <KOut, VOut> RCollectionMapReduce<V,KOut,VOut> mapReduce()
    • size

      public int size()
    • sizeAsync

      public RFuture<Integer> sizeAsync()
    • isEmpty

      public boolean isEmpty()
    • contains

      public boolean contains(Object o)
    • iterator

      public Iterator<V> iterator()
    • toArray

      public Object[] toArray()
    • readAll

      public List<V> readAll()
    • readAllAsync

      public RFuture<List<V>> readAllAsync()
    • toArray

      public <T> T[] toArray(T[] a)
    • add

      public boolean add(V e)
    • addAsync

      public RFuture<Boolean> addAsync(V e)
    • addAsync

      protected <T> RFuture<T> addAsync(V e, RedisCommand<T> command)
    • remove

      public boolean remove(Object o)
    • removeAsync

      public RFuture<Boolean> removeAsync(Object o)
    • removeAsync

      public RFuture<Boolean> removeAsync(Object o, int count)
    • remove

      public boolean remove(Object o, int count)
    • containsAllAsync

      public RFuture<Boolean> containsAllAsync(Collection<?> c)
    • containsAll

      public boolean containsAll(Collection<?> c)
    • addAll

      public boolean addAll(Collection<? extends V> c)
    • addAllAsync

      public RFuture<Boolean> addAllAsync(Collection<? extends V> c)
    • addAllAsync

      public RFuture<Boolean> addAllAsync(int index, Collection<? extends V> coll)
    • addAll

      public boolean addAll(int index, Collection<? extends V> coll)
    • removeAllAsync

      public RFuture<Boolean> removeAllAsync(Collection<?> c)
    • removeAll

      public boolean removeAll(Collection<?> c)
    • retainAll

      public boolean retainAll(Collection<?> c)
    • retainAllAsync

      public RFuture<Boolean> retainAllAsync(Collection<?> c)
    • clear

      public void clear()
    • getAsync

      public RFuture<V> getAsync(int index)
    • get

      public List<V> get(int... indexes)
    • distributedIterator

      public Iterator<V> distributedIterator(int count)
    • distributedIterator

      public Iterator<V> distributedIterator(String iteratorName, int count)
    • getAsync

      public RFuture<List<V>> getAsync(int... indexes)
    • get

      public V get(int index)
    • set

      public V set(int index, V element)
    • setAsync

      public RFuture<V> setAsync(int index, V element)
    • fastSet

      public void fastSet(int index, V element)
    • fastSetAsync

      public RFuture<Void> fastSetAsync(int index, V element)
    • add

      public void add(int index, V element)
    • addAsync

      public RFuture<Boolean> addAsync(int index, V element)
    • remove

      public V remove(int index)
    • removeAsync

      public RFuture<V> removeAsync(int index)
    • fastRemove

      public void fastRemove(int index)
    • fastRemoveAsync

      public RFuture<Void> fastRemoveAsync(int index)
    • indexOf

      public int indexOf(Object o)
    • containsAsync

      public RFuture<Boolean> containsAsync(Object o)
    • indexOfAsync

      public <R> RFuture<R> indexOfAsync(Object o, Convertor<R> convertor)
    • indexOfAsync

      public RFuture<Integer> indexOfAsync(Object o)
    • lastIndexOf

      public int lastIndexOf(Object o)
    • lastIndexOfAsync

      public RFuture<Integer> lastIndexOfAsync(Object o)
    • lastIndexOfAsync

      public <R> RFuture<R> lastIndexOfAsync(Object o, Convertor<R> convertor)
    • trim

      public void trim(int fromIndex, int toIndex)
    • trimAsync

      public RFuture<Void> trimAsync(int fromIndex, int toIndex)
    • listIterator

      public ListIterator<V> listIterator()
    • listIterator

      public ListIterator<V> listIterator(int ind)
    • subList

      public RList<V> subList(int fromIndex, int toIndex)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • addAfterAsync

      public RFuture<Integer> addAfterAsync(V elementToFind, V element)
    • addBeforeAsync

      public RFuture<Integer> addBeforeAsync(V elementToFind, V element)
    • addAfter

      public int addAfter(V elementToFind, V element)
    • addBefore

      public int addBefore(V elementToFind, V element)
    • readSort

      public List<V> readSort(SortOrder order)
    • readSortAsync

      public RFuture<List<V>> readSortAsync(SortOrder order)
    • readSort

      public List<V> readSort(SortOrder order, int offset, int count)
    • readSortAsync

      public RFuture<List<V>> readSortAsync(SortOrder order, int offset, int count)
    • readSort

      public List<V> readSort(String byPattern, SortOrder order)
    • readSortAsync

      public RFuture<List<V>> readSortAsync(String byPattern, SortOrder order)
    • readSort

      public List<V> readSort(String byPattern, SortOrder order, int offset, int count)
    • readSortAsync

      public RFuture<List<V>> readSortAsync(String byPattern, SortOrder order, int offset, int count)
    • readSort

      public <T> Collection<T> readSort(String byPattern, List<String> getPatterns, SortOrder order)
    • readSortAsync

      public <T> RFuture<Collection<T>> readSortAsync(String byPattern, List<String> getPatterns, SortOrder order)
    • readSort

      public <T> Collection<T> readSort(String byPattern, List<String> getPatterns, SortOrder order, int offset, int count)
    • readSortAsync

      public <T> RFuture<Collection<T>> readSortAsync(String byPattern, List<String> getPatterns, SortOrder order, int offset, int count)
    • readSortAlpha

      public List<V> readSortAlpha(SortOrder order)
    • readSortAlphaAsync

      public RFuture<List<V>> readSortAlphaAsync(SortOrder order)
    • readSortAlpha

      public List<V> readSortAlpha(SortOrder order, int offset, int count)
    • readSortAlphaAsync

      public RFuture<List<V>> readSortAlphaAsync(SortOrder order, int offset, int count)
    • readSortAlpha

      public List<V> readSortAlpha(String byPattern, SortOrder order)
    • readSortAlphaAsync

      public RFuture<List<V>> readSortAlphaAsync(String byPattern, SortOrder order)
    • readSortAlpha

      public List<V> readSortAlpha(String byPattern, SortOrder order, int offset, int count)
    • readSortAlphaAsync

      public RFuture<List<V>> readSortAlphaAsync(String byPattern, SortOrder order, int offset, int count)
    • readSortAlpha

      public <T> Collection<T> readSortAlpha(String byPattern, List<String> getPatterns, SortOrder order)
    • readSortAlphaAsync

      public <T> RFuture<Collection<T>> readSortAlphaAsync(String byPattern, List<String> getPatterns, SortOrder order)
    • readSortAlpha

      public <T> Collection<T> readSortAlpha(String byPattern, List<String> getPatterns, SortOrder order, int offset, int count)
    • readSortAlphaAsync

      public <T> RFuture<Collection<T>> readSortAlphaAsync(String byPattern, List<String> getPatterns, SortOrder order, int offset, int count)
    • sortTo

      public int sortTo(String destName, SortOrder order)
    • sortToAsync

      public RFuture<Integer> sortToAsync(String destName, SortOrder order)
    • sortTo

      public int sortTo(String destName, SortOrder order, int offset, int count)
    • sortToAsync

      public RFuture<Integer> sortToAsync(String destName, SortOrder order, int offset, int count)
    • sortTo

      public int sortTo(String destName, String byPattern, SortOrder order, int offset, int count)
    • sortTo

      public int sortTo(String destName, String byPattern, SortOrder order)
    • sortToAsync

      public RFuture<Integer> sortToAsync(String destName, String byPattern, SortOrder order)
    • sortToAsync

      public RFuture<Integer> sortToAsync(String destName, String byPattern, SortOrder order, int offset, int count)
    • sortTo

      public int sortTo(String destName, String byPattern, List<String> getPatterns, SortOrder order)
    • sortToAsync

      public RFuture<Integer> sortToAsync(String destName, String byPattern, List<String> getPatterns, SortOrder order)
    • sortTo

      public int sortTo(String destName, String byPattern, List<String> getPatterns, SortOrder order, int offset, int count)
    • sortToAsync

      public RFuture<Integer> sortToAsync(String destName, String byPattern, List<String> getPatterns, SortOrder order, int offset, int count)
    • rangeAsync

      public RFuture<List<V>> rangeAsync(int toIndex)
    • rangeAsync

      public RFuture<List<V>> rangeAsync(int fromIndex, int toIndex)
    • range

      public List<V> range(int toIndex)
    • range

      public List<V> range(int fromIndex, int toIndex)
    • addListener

      public int addListener(ObjectListener listener)
      Description copied from interface: RObject
      Adds object event listener
      Specified by:
      addListener in interface RObject
      Overrides:
      addListener in class RedissonObject
      Parameters:
      listener - - object event listener
      Returns:
      listener id
      See Also:
    • addListenerAsync

      public RFuture<Integer> addListenerAsync(ObjectListener listener)
      Description copied from interface: RObjectAsync
      Adds object event listener
      Specified by:
      addListenerAsync in interface RObjectAsync
      Overrides:
      addListenerAsync in class RedissonObject
      Parameters:
      listener - - object event listener
      Returns:
      listener id
      See Also:
    • removeListener

      public void removeListener(int listenerId)
      Description copied from interface: RObject
      Removes object event listener
      Specified by:
      removeListener in interface RObject
      Overrides:
      removeListener in class RedissonObject
      Parameters:
      listenerId - - listener id
    • removeListenerAsync

      public RFuture<Void> removeListenerAsync(int listenerId)
      Description copied from interface: RObjectAsync
      Removes object event listener
      Specified by:
      removeListenerAsync in interface RObjectAsync
      Overrides:
      removeListenerAsync in class RedissonObject
      Parameters:
      listenerId - - listener id
    • removeIf

      public boolean removeIf(Predicate<? super V> filter)
    • expire

      public boolean expire(long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RExpirable
      Specified by:
      expire in interface RExpirable
      Parameters:
      timeToLive - - timeout before object will be deleted
      timeUnit - - timeout time unit
      Returns:
      true if the timeout was set and false if not
    • expireAsync

      public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAsync in interface RExpirableAsync
      Parameters:
      timeToLive - - timeout before object will be deleted
      timeUnit - - timeout time unit
      Returns:
      true if the timeout was set and false if not
    • expireAt

      public boolean expireAt(long timestamp)
      Description copied from interface: RExpirable
      Specified by:
      expireAt in interface RExpirable
      Parameters:
      timestamp - - expire date in milliseconds (Unix timestamp)
      Returns:
      true if the timeout was set and false if not
    • expireAtAsync

      public RFuture<Boolean> expireAtAsync(long timestamp)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAtAsync in interface RExpirableAsync
      Parameters:
      timestamp - - expire date in milliseconds (Unix timestamp)
      Returns:
      true if the timeout was set and false if not
    • expire

      public boolean expire(Instant instant)
      Description copied from interface: RExpirable
      Sets an expiration date for this object. When expire date comes the key will automatically be deleted.
      Specified by:
      expire in interface RExpirable
      Parameters:
      instant - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSet

      public boolean expireIfSet(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSet in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSetAsync

      public RFuture<Boolean> expireIfSetAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSetAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSet

      public boolean expireIfNotSet(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSet in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSetAsync

      public RFuture<Boolean> expireIfNotSetAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSetAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfGreater

      public boolean expireIfGreater(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreater in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfGreaterAsync

      public RFuture<Boolean> expireIfGreaterAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreaterAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfLess

      public boolean expireIfLess(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLess in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfLessAsync

      public RFuture<Boolean> expireIfLessAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLessAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireAsync

      public RFuture<Boolean> expireAsync(Instant instant)
      Description copied from interface: RExpirableAsync
      Set an expire date for object. When expire date comes the key will automatically be deleted.
      Specified by:
      expireAsync in interface RExpirableAsync
      Parameters:
      instant - - expire date
      Returns:
      true if the timeout was set and false if not
    • expire

      public boolean expire(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object. After the timeout has expired, the key will automatically be deleted.
      Specified by:
      expire in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireAsync

      public RFuture<Boolean> expireAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Set a timeout for object. After the timeout has expired, the key will automatically be deleted.
      Specified by:
      expireAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireAt

      public boolean expireAt(Date timestamp)
      Description copied from interface: RExpirable
      Specified by:
      expireAt in interface RExpirable
      Parameters:
      timestamp - - expire date
      Returns:
      true if the timeout was set and false if not
    • expireAtAsync

      public RFuture<Boolean> expireAtAsync(Date timestamp)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAtAsync in interface RExpirableAsync
      Parameters:
      timestamp - - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSet

      public boolean expireIfSet(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSet in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfSetAsync

      public RFuture<Boolean> expireIfSetAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSetAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSet

      public boolean expireIfNotSet(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSet in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSetAsync

      public RFuture<Boolean> expireIfNotSetAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSetAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfGreater

      public boolean expireIfGreater(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreater in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfGreaterAsync

      public RFuture<Boolean> expireIfGreaterAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreaterAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfLess

      public boolean expireIfLess(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLess in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfLessAsync

      public RFuture<Boolean> expireIfLessAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLessAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • clearExpire

      public boolean clearExpire()
      Description copied from interface: RExpirable
      Clear an expire timeout or expire date for object.
      Specified by:
      clearExpire in interface RExpirable
      Returns:
      true if timeout was removed false 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 interface RExpirableAsync
      Returns:
      true if the timeout was cleared and false 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 interface RExpirable
      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 interface RExpirableAsync
      Returns:
      time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
    • getExpireTime

      public long getExpireTime()
      Description copied from interface: RExpirable
      Expiration time of Redisson object that has a timeout

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTime in interface RExpirable
      Returns:
      expiration time
    • getExpireTimeAsync

      public RFuture<Long> getExpireTimeAsync()
      Description copied from interface: RExpirableAsync
      Expiration time of Redisson object that has a timeout

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTimeAsync in interface RExpirableAsync
      Returns:
      expiration time
    • expireAsync

      protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String param, String... keys)
    • expireAtAsync

      protected RFuture<Boolean> expireAtAsync(long timestamp, String param, String... keys)
    • clearExpireAsync

      protected RFuture<Boolean> clearExpireAsync(String... keys)