Checkstyle fixes.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1369931 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cf940ca403
commit
614013ae31
|
@ -55,14 +55,18 @@ public abstract class AbstractMapEntryDecorator<K, V> implements Map.Entry<K, V>
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public K getKey() {
|
||||
return entry.getKey();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V getValue() {
|
||||
return entry.getValue();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public V setValue(V object) {
|
||||
return entry.setValue(object);
|
||||
}
|
||||
|
|
|
@ -99,33 +99,43 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int size() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isEmpty() {
|
||||
return (size() == 0);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E get(int index) {
|
||||
Node<E> node = getNode(index, false);
|
||||
return node.getValue();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public Iterator<E> iterator() {
|
||||
return listIterator();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public ListIterator<E> listIterator() {
|
||||
return new LinkedListIterator<E>(this, 0);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public ListIterator<E> listIterator(int fromIndex) {
|
||||
return new LinkedListIterator<E>(this, fromIndex);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int indexOf(Object value) {
|
||||
int i = 0;
|
||||
for (Node<E> node = header.next; node != header; node = node.next) {
|
||||
|
@ -137,6 +147,7 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
return -1;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int lastIndexOf(Object value) {
|
||||
int i = size - 1;
|
||||
for (Node<E> node = header.previous; node != header; node = node.previous) {
|
||||
|
@ -148,10 +159,12 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
return -1;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean contains(Object value) {
|
||||
return indexOf(value) != -1;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean containsAll(Collection<?> coll) {
|
||||
for (Object o : coll) {
|
||||
if (!contains(o)) {
|
||||
|
@ -162,10 +175,13 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public Object[] toArray() {
|
||||
return toArray(new Object[size]);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T[] toArray(T[] array) {
|
||||
// Extend the array if needed
|
||||
|
@ -197,20 +213,25 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean add(E value) {
|
||||
addLast(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void add(int index, E value) {
|
||||
Node<E> node = getNode(index, true);
|
||||
addNodeBefore(node, value);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll(Collection<? extends E> coll) {
|
||||
return addAll(size, coll);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll(int index, Collection<? extends E> coll) {
|
||||
Node<E> node = getNode(index, true);
|
||||
for (E e : coll) {
|
||||
|
@ -220,6 +241,8 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E remove(int index) {
|
||||
Node<E> node = getNode(index, false);
|
||||
E oldValue = node.getValue();
|
||||
|
@ -227,6 +250,7 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
return oldValue;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean remove(Object value) {
|
||||
for (Node<E> node = header.next; node != header; node = node.next) {
|
||||
if (isEqualValue(node.getValue(), value)) {
|
||||
|
@ -237,6 +261,7 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
return false;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean removeAll(Collection<?> coll) {
|
||||
boolean modified = false;
|
||||
Iterator<E> it = iterator();
|
||||
|
@ -250,6 +275,8 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean retainAll(Collection<?> coll) {
|
||||
boolean modified = false;
|
||||
Iterator<E> it = iterator();
|
||||
|
@ -262,6 +289,7 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
return modified;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E set(int index, E value) {
|
||||
Node<E> node = getNode(index, false);
|
||||
E oldValue = node.getValue();
|
||||
|
@ -269,11 +297,13 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
return oldValue;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void clear() {
|
||||
removeAllNodes();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
public E getFirst() {
|
||||
Node<E> node = header.next;
|
||||
if (node == header) {
|
||||
|
@ -338,8 +368,9 @@ public abstract class AbstractLinkedList<E> implements List<E> {
|
|||
while (it1.hasNext() && it2.hasNext()) {
|
||||
Object o1 = it1.next();
|
||||
Object o2 = it2.next();
|
||||
if (!(o1 == null ? o2 == null : o1.equals(o2)))
|
||||
if (!(o1 == null ? o2 == null : o1.equals(o2))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !(it1.hasNext() || it2.hasNext());
|
||||
}
|
||||
|
|
|
@ -66,42 +66,53 @@ public abstract class AbstractListDecorator<E> extends AbstractCollectionDecorat
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void add(int index, E object) {
|
||||
decorated().add(index, object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll(int index, Collection<? extends E> coll) {
|
||||
return decorated().addAll(index, coll);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E get(int index) {
|
||||
return decorated().get(index);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int indexOf(Object object) {
|
||||
return decorated().indexOf(object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int lastIndexOf(Object object) {
|
||||
return decorated().lastIndexOf(object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public ListIterator<E> listIterator() {
|
||||
return decorated().listIterator();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
return decorated().listIterator(index);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E remove(int index) {
|
||||
return decorated().remove(index);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E set(int index, E object) {
|
||||
return decorated().set(index, object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return decorated().subList(fromIndex, toIndex);
|
||||
}
|
||||
|
|
|
@ -383,6 +383,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
|
|||
*
|
||||
* @param subList the sublist to get an iterator for
|
||||
* @param fromIndex the index to start from, relative to the sublist
|
||||
* @return the list iterator for the sublist
|
||||
*/
|
||||
@Override
|
||||
protected ListIterator<E> createSubListListIterator(LinkedSubList<E> subList, int fromIndex) {
|
||||
|
@ -407,6 +408,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
|
|||
/**
|
||||
* Constructs a new cursor.
|
||||
*
|
||||
* @param parent the parent list
|
||||
* @param index the index to start from
|
||||
*/
|
||||
protected Cursor(CursorableLinkedList<E> parent, int index) {
|
||||
|
@ -577,6 +579,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
|
|||
/**
|
||||
* Constructs a new cursor.
|
||||
*
|
||||
* @param sub the sub list
|
||||
* @param index the index to start from
|
||||
*/
|
||||
protected SubCursor(LinkedSubList<E> sub, int index) {
|
||||
|
|
|
@ -170,10 +170,12 @@ public class FixedSizeList<E>
|
|||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isFull() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int maxSize() {
|
||||
return size();
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ public class LazyList<E> extends AbstractSerializableListDecorator<E> {
|
|||
* placeholder that is replaced with a factory object when requested.
|
||||
*
|
||||
* @param index the index to retrieve
|
||||
* @return the element at the given index
|
||||
*/
|
||||
@Override
|
||||
public E get(int index) {
|
||||
|
|
|
@ -89,28 +89,36 @@ public class PredicatedList<E> extends PredicatedCollection<E> implements List<E
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E get(int index) {
|
||||
return decorated().get(index);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int indexOf(Object object) {
|
||||
return decorated().indexOf(object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int lastIndexOf(Object object) {
|
||||
return decorated().lastIndexOf(object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E remove(int index) {
|
||||
return decorated().remove(index);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void add(int index, E object) {
|
||||
validate(object);
|
||||
decorated().add(index, object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll(int index, Collection<? extends E> coll) {
|
||||
for (E aColl : coll) {
|
||||
validate(aColl);
|
||||
|
@ -118,19 +126,23 @@ public class PredicatedList<E> extends PredicatedCollection<E> implements List<E
|
|||
return decorated().addAll(index, coll);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public ListIterator<E> listIterator() {
|
||||
return listIterator(0);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public ListIterator<E> listIterator(int i) {
|
||||
return new PredicatedListIterator(decorated().listIterator(i));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E set(int index, E object) {
|
||||
validate(object);
|
||||
return decorated().set(index, object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
List<E> sub = decorated().subList(fromIndex, toIndex);
|
||||
return new PredicatedList<E>(sub, predicate);
|
||||
|
@ -141,6 +153,11 @@ public class PredicatedList<E> extends PredicatedCollection<E> implements List<E
|
|||
*/
|
||||
protected class PredicatedListIterator extends AbstractListIteratorDecorator<E> {
|
||||
|
||||
/**
|
||||
* Create a new predicated list iterator.
|
||||
*
|
||||
* @param iterator the list iterator to decorate
|
||||
*/
|
||||
protected PredicatedListIterator(ListIterator<E> iterator) {
|
||||
super(iterator);
|
||||
}
|
||||
|
|
|
@ -82,30 +82,36 @@ public class SynchronizedList<E> extends SynchronizedCollection<E> implements Li
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void add(int index, E object) {
|
||||
synchronized (lock) {
|
||||
getList().add(index, object);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll(int index, Collection<? extends E> coll) {
|
||||
synchronized (lock) {
|
||||
return getList().addAll(index, coll);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E get(int index) {
|
||||
synchronized (lock) {
|
||||
return getList().get(index);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int indexOf(Object object) {
|
||||
synchronized (lock) {
|
||||
return getList().indexOf(object);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int lastIndexOf(Object object) {
|
||||
synchronized (lock) {
|
||||
return getList().lastIndexOf(object);
|
||||
|
@ -134,24 +140,28 @@ public class SynchronizedList<E> extends SynchronizedCollection<E> implements Li
|
|||
* // do stuff with iterator
|
||||
* }
|
||||
*
|
||||
* @param index index of first element to be returned by this list iterator
|
||||
* @return an iterator that must be manually synchronized on the collection
|
||||
*/
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
return getList().listIterator(index);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E remove(int index) {
|
||||
synchronized (lock) {
|
||||
return getList().remove(index);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E set(int index, E object) {
|
||||
synchronized (lock) {
|
||||
return getList().set(index, object);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
synchronized (lock) {
|
||||
List<E> list = getList().subList(fromIndex, toIndex);
|
||||
|
|
|
@ -114,46 +114,58 @@ public class TransformedList<E> extends TransformedCollection<E> implements List
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E get(int index) {
|
||||
return getList().get(index);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int indexOf(Object object) {
|
||||
return getList().indexOf(object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int lastIndexOf(Object object) {
|
||||
return getList().lastIndexOf(object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E remove(int index) {
|
||||
return getList().remove(index);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void add(int index, E object) {
|
||||
object = transform(object);
|
||||
getList().add(index, object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean addAll(int index, Collection<? extends E> coll) {
|
||||
coll = transform(coll);
|
||||
return getList().addAll(index, coll);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public ListIterator<E> listIterator() {
|
||||
return listIterator(0);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public ListIterator<E> listIterator(int i) {
|
||||
return new TransformedListIterator(getList().listIterator(i));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public E set(int index, E object) {
|
||||
object = transform(object);
|
||||
return getList().set(index, object);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
List<E> sub = getList().subList(fromIndex, toIndex);
|
||||
return new TransformedList<E>(sub, transformer);
|
||||
|
@ -164,6 +176,11 @@ public class TransformedList<E> extends TransformedCollection<E> implements List
|
|||
*/
|
||||
protected class TransformedListIterator extends AbstractListIteratorDecorator<E> {
|
||||
|
||||
/**
|
||||
* Create a new transformed list iterator.
|
||||
*
|
||||
* @param iterator the list iterator to decorate
|
||||
*/
|
||||
protected TransformedListIterator(ListIterator<E> iterator) {
|
||||
super(iterator);
|
||||
}
|
||||
|
|
|
@ -146,6 +146,7 @@ public class TreeList<E> extends AbstractList<E> {
|
|||
/**
|
||||
* Searches for the index of an object in the list.
|
||||
*
|
||||
* @param object the object to search
|
||||
* @return the index of the object, -1 if not found
|
||||
*/
|
||||
@Override
|
||||
|
@ -160,6 +161,7 @@ public class TreeList<E> extends AbstractList<E> {
|
|||
/**
|
||||
* Searches for the presence of an object in the list.
|
||||
*
|
||||
* @param object the object to check
|
||||
* @return true if the object is found
|
||||
*/
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue