@Override public boolean add(E value) { listOps.rightPush(value); cap(); return true; }
@Override public boolean offer(E e) { listOps.rightPush(e); cap(); return true; }
@Override public void addFirst(E e) { listOps.leftPush(e); cap(); }
@Override public void add(int index, E element) { if (index == 0) { listOps.leftPush(element); cap(); return; } int size = size(); if (index == size()) { listOps.rightPush(element); cap(); return; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
@Override public boolean addAll(int index, Collection<? extends E> c) { // insert collection in reverse if (index == 0) { Collection<? extends E> reverseC = CollectionUtils.reverse(c); for (E e : reverseC) { listOps.leftPush(e); cap(); } return true; } int size = size(); if (index == size()) { for (E e : c) { listOps.rightPush(e); cap(); } return true; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
@Override public boolean offer(E e) { listOps.rightPush(e); cap(); return true; }
@Override public boolean add(E value) { listOps.rightPush(value); cap(); return true; }
@Override public boolean offer(E e) { listOps.rightPush(e); cap(); return true; }
@Override public void addFirst(E e) { listOps.leftPush(e); cap(); }
@Override public boolean add(E value) { listOps.rightPush(value); cap(); return true; }
@Override public void addFirst(E e) { listOps.leftPush(e); cap(); }
@Override public void add(int index, E element) { if (index == 0) { listOps.leftPush(element); cap(); return; } int size = size(); if (index == size()) { listOps.rightPush(element); cap(); return; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
@Override public void add(int index, E element) { if (index == 0) { listOps.leftPush(element); cap(); return; } int size = size(); if (index == size()) { listOps.rightPush(element); cap(); return; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
@Override public boolean addAll(int index, Collection<? extends E> c) { // insert collection in reverse if (index == 0) { Collection<? extends E> reverseC = CollectionUtils.reverse(c); for (E e : reverseC) { listOps.leftPush(e); cap(); } return true; } int size = size(); if (index == size()) { for (E e : c) { listOps.rightPush(e); cap(); } return true; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
@Override public boolean addAll(int index, Collection<? extends E> c) { // insert collection in reverse if (index == 0) { Collection<? extends E> reverseC = CollectionUtils.reverse(c); for (E e : reverseC) { listOps.leftPush(e); cap(); } return true; } int size = size(); if (index == size()) { for (E e : c) { listOps.rightPush(e); cap(); } return true; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }