public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements RedisList<E>
RedisList. Suitable for not just lists, but also queues (FIFO ordering) or stacks
(LIFO ordering) and deques (or double ended queues). Allows the maximum size (or the cap) to be specified to prevent
the list from over growing. Note that all write operations will execute immediately, whether a cap is specified or
not - the list will always accept new items (trimming the tail after each insert in case of capped collections).ENCODING| Constructor and Description |
|---|
DefaultRedisList(BoundListOperations<String,E> boundOps)
Constructs a new, uncapped
DefaultRedisList instance. |
DefaultRedisList(BoundListOperations<String,E> boundOps,
int maxSize)
Constructs a new
DefaultRedisList instance. |
DefaultRedisList(String key,
RedisOperations<String,E> operations)
Constructs a new, uncapped
DefaultRedisList instance. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E value) |
void |
add(int index,
E element) |
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
addFirst(E e) |
void |
addLast(E e) |
void |
clear() |
Iterator<E> |
descendingIterator() |
int |
drainTo(Collection<? super E> c) |
int |
drainTo(Collection<? super E> c,
int maxElements) |
E |
element() |
E |
get(int index) |
E |
getFirst() |
E |
getLast() |
DataType |
getType()
Returns the associated Redis type.
|
int |
indexOf(Object o) |
Iterator<E> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
boolean |
offer(E e) |
boolean |
offer(E e,
long timeout,
TimeUnit unit) |
boolean |
offerFirst(E e) |
boolean |
offerFirst(E e,
long timeout,
TimeUnit unit) |
boolean |
offerLast(E e) |
boolean |
offerLast(E e,
long timeout,
TimeUnit unit) |
E |
peek() |
E |
peekFirst() |
E |
peekLast() |
E |
poll() |
E |
poll(long timeout,
TimeUnit unit) |
E |
pollFirst() |
E |
pollFirst(long timeout,
TimeUnit unit) |
E |
pollLast() |
E |
pollLast(long timeout,
TimeUnit unit) |
E |
pop() |
void |
push(E e) |
void |
put(E e) |
void |
putFirst(E e) |
void |
putLast(E e) |
List<E> |
range(long start,
long end) |
int |
remainingCapacity() |
E |
remove() |
E |
remove(int index) |
boolean |
remove(Object o) |
E |
removeFirst() |
boolean |
removeFirstOccurrence(Object o) |
E |
removeLast() |
boolean |
removeLastOccurrence(Object o) |
E |
set(int index,
E e) |
void |
setMaxSize(int maxSize)
Sets the maximum size of the (capped) list.
|
int |
size() |
List<E> |
subList(int fromIndex,
int toIndex) |
E |
take() |
E |
takeFirst() |
E |
takeLast() |
RedisList<E> |
trim(int start,
int end) |
addAll, checkResult, containsAll, equals, expire, expireAt, getExpire, getKey, getOperations, hashCode, persist, removeAll, rename, toStringcontains, isEmpty, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetOperationsexpire, expireAt, getExpire, getKey, persist, renameaddAll, contains, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArraycontainspublic DefaultRedisList(String key, RedisOperations<String,E> operations)
DefaultRedisList instance.key - operations - public DefaultRedisList(BoundListOperations<String,E> boundOps)
DefaultRedisList instance.boundOps - public DefaultRedisList(BoundListOperations<String,E> boundOps, int maxSize)
DefaultRedisList instance.boundOps - maxSize - public void setMaxSize(int maxSize)
maxSize - list maximum sizepublic int size()
size in interface Collection<E>size in interface BlockingDeque<E>size in interface Deque<E>size in interface List<E>size in class AbstractCollection<E>public boolean add(E value)
add in interface Collection<E>add in interface BlockingDeque<E>add in interface BlockingQueue<E>add in interface Deque<E>add in interface List<E>add in interface Queue<E>add in class AbstractCollection<E>public void clear()
clear in interface Collection<E>clear in interface List<E>clear in class AbstractCollection<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface BlockingDeque<E>remove in interface BlockingQueue<E>remove in interface Deque<E>remove in interface List<E>remove in class AbstractCollection<E>public boolean addAll(int index,
Collection<? extends E> c)
public int lastIndexOf(Object o)
lastIndexOf in interface List<E>public ListIterator<E> listIterator()
listIterator in interface List<E>public ListIterator<E> listIterator(int index)
listIterator in interface List<E>public E element()
public boolean offer(E e)
public E peek()
public E poll()
public E remove()
public void addFirst(E e)
public void addLast(E e)
public Iterator<E> descendingIterator()
descendingIterator in interface Deque<E>public boolean offerFirst(E e)
offerFirst in interface BlockingDeque<E>offerFirst in interface Deque<E>public boolean offerLast(E e)
public void push(E e)
public E removeFirst()
removeFirst in interface Deque<E>public boolean removeFirstOccurrence(Object o)
removeFirstOccurrence in interface BlockingDeque<E>removeFirstOccurrence in interface Deque<E>public E removeLast()
removeLast in interface Deque<E>public boolean removeLastOccurrence(Object o)
removeLastOccurrence in interface BlockingDeque<E>removeLastOccurrence in interface Deque<E>public int drainTo(Collection<? super E> c, int maxElements)
drainTo in interface BlockingQueue<E>public int drainTo(Collection<? super E> c)
drainTo in interface BlockingQueue<E>public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingDeque<E>offer in interface BlockingQueue<E>InterruptedExceptionpublic E poll(long timeout, TimeUnit unit) throws InterruptedException
poll in interface BlockingDeque<E>poll in interface BlockingQueue<E>InterruptedExceptionpublic void put(E e) throws InterruptedException
put in interface BlockingDeque<E>put in interface BlockingQueue<E>InterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface BlockingQueue<E>public E take() throws InterruptedException
take in interface BlockingDeque<E>take in interface BlockingQueue<E>InterruptedExceptionpublic boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException
offerFirst in interface BlockingDeque<E>InterruptedExceptionpublic boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException
offerLast in interface BlockingDeque<E>InterruptedExceptionpublic E pollFirst(long timeout, TimeUnit unit) throws InterruptedException
pollFirst in interface BlockingDeque<E>InterruptedExceptionpublic E pollLast(long timeout, TimeUnit unit) throws InterruptedException
pollLast in interface BlockingDeque<E>InterruptedExceptionpublic void putFirst(E e) throws InterruptedException
putFirst in interface BlockingDeque<E>InterruptedExceptionpublic void putLast(E e) throws InterruptedException
putLast in interface BlockingDeque<E>InterruptedExceptionpublic E takeFirst() throws InterruptedException
takeFirst in interface BlockingDeque<E>InterruptedExceptionpublic E takeLast() throws InterruptedException
takeLast in interface BlockingDeque<E>InterruptedExceptionpublic DataType getType()
BoundKeyOperationsgetType in interface BoundKeyOperations<String>