Use final for params.

This commit is contained in:
Gary Gregory 2017-10-11 16:25:21 -06:00
parent 8713af90d5
commit cefe846e3e
45 changed files with 156 additions and 156 deletions

View File

@ -923,7 +923,7 @@ public class CollectionUtils {
* @since 4.1
*/
public static <O, R extends Collection<? super O>> R select(final Iterable<? extends O> inputCollection,
final Predicate<? super O> predicate, R outputCollection, R rejectedCollection) {
final Predicate<? super O> predicate, final R outputCollection, final R rejectedCollection) {
if (inputCollection != null && predicate != null) {
for (final O element : inputCollection) {
@ -1506,8 +1506,8 @@ public class CollectionUtils {
* @throws NullPointerException if either collection is null
* @since 4.0
*/
public static <O extends Comparable<? super O>> List<O> collate(Iterable<? extends O> a,
Iterable<? extends O> b) {
public static <O extends Comparable<? super O>> List<O> collate(final Iterable<? extends O> a,
final Iterable<? extends O> b) {
return collate(a, b, ComparatorUtils.<O>naturalComparator(), true);
}
@ -1688,7 +1688,7 @@ public class CollectionUtils {
final Transformer<E, EquatorWrapper<E>> transformer = new Transformer<E, EquatorWrapper<E>>() {
@Override
public EquatorWrapper<E> transform(E input) {
public EquatorWrapper<E> transform(final E input) {
return new EquatorWrapper<>(equator, input);
}
};
@ -1764,7 +1764,7 @@ public class CollectionUtils {
final Transformer<E, EquatorWrapper<E>> transformer = new Transformer<E, EquatorWrapper<E>>() {
@Override
public EquatorWrapper<E> transform(E input) {
public EquatorWrapper<E> transform(final E input) {
return new EquatorWrapper<>(equator, input);
}
};

View File

@ -172,7 +172,7 @@ public class IterableUtils {
public Iterator<E> iterator() {
return new LazyIteratorChain<E>() {
@Override
protected Iterator<? extends E> nextIterator(int count) {
protected Iterator<? extends E> nextIterator(final int count) {
if (count > iterables.length) {
return null;
} else {
@ -325,7 +325,7 @@ public class IterableUtils {
public Iterator<E> iterator() {
return new LazyIteratorChain<E>() {
@Override
protected Iterator<? extends E> nextIterator(int count) {
protected Iterator<? extends E> nextIterator(final int count) {
if (IterableUtils.isEmpty(iterable)) {
return null;
} else {

View File

@ -433,7 +433,7 @@ public class IteratorUtils {
* @throws IllegalArgumentException if max is negative
* @since 4.1
*/
public static <E> BoundedIterator<E> boundedIterator(final Iterator<? extends E> iterator, long max) {
public static <E> BoundedIterator<E> boundedIterator(final Iterator<? extends E> iterator, final long max) {
return boundedIterator(iterator, 0, max);
}
@ -455,7 +455,7 @@ public class IteratorUtils {
* @since 4.1
*/
public static <E> BoundedIterator<E> boundedIterator(final Iterator<? extends E> iterator,
long offset, long max) {
final long offset, final long max) {
return new BoundedIterator<>(iterator, offset, max);
}
@ -890,7 +890,7 @@ public class IteratorUtils {
* @throws IllegalArgumentException if offset is negative
* @since 4.1
*/
public static <E> SkippingIterator<E> skippingIterator(final Iterator<E> iterator, long offset) {
public static <E> SkippingIterator<E> skippingIterator(final Iterator<E> iterator, final long offset) {
return new SkippingIterator<>(iterator, offset);
}

View File

@ -613,7 +613,7 @@ public class ListUtils {
}
@Override
public Character get( int index ) {
public Character get( final int index ) {
return Character.valueOf(sequence.charAt( index ));
}

View File

@ -1798,7 +1798,7 @@ public class MapUtils {
* @param map a Map or null
* @return the given map size or 0 if the map is null
*/
public static int size(Map<?, ?> map) {
public static int size(final Map<?, ?> map) {
return map == null ? 0 : map.size();
}

View File

@ -446,7 +446,7 @@ public class SetUtils {
return new SetView<E>() {
@Override
public boolean contains(Object o) {
public boolean contains(final Object o) {
return a.contains(o) || b.contains(o);
}
@ -488,14 +488,14 @@ public class SetUtils {
final Predicate<E> notContainedInB = new Predicate<E>() {
@Override
public boolean evaluate(E object) {
public boolean evaluate(final E object) {
return !b.contains(object);
}
};
return new SetView<E>() {
@Override
public boolean contains(Object o) {
public boolean contains(final Object o) {
return a.contains(o) && !b.contains(o);
}
@ -526,14 +526,14 @@ public class SetUtils {
final Predicate<E> containedInB = new Predicate<E>() {
@Override
public boolean evaluate(E object) {
public boolean evaluate(final E object) {
return b.contains(object);
}
};
return new SetView<E>() {
@Override
public boolean contains(Object o) {
public boolean contains(final Object o) {
return a.contains(o) && b.contains(o);
}
@ -570,7 +570,7 @@ public class SetUtils {
return new SetView<E>() {
@Override
public boolean contains(Object o) {
public boolean contains(final Object o) {
return a.contains(o) ^ b.contains(o);
}

View File

@ -53,7 +53,7 @@ public abstract class AbstractKeyValue<K, V> implements KeyValue<K, V> {
return key;
}
protected K setKey(K key) {
protected K setKey(final K key) {
final K old = this.key;
this.key = key;
return old;
@ -69,7 +69,7 @@ public abstract class AbstractKeyValue<K, V> implements KeyValue<K, V> {
return value;
}
protected V setValue(V value) {
protected V setValue(final V value) {
final V old = this.value;
this.value = value;
return old;

View File

@ -1059,7 +1059,7 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
* @param type the type to check against.
* @return true if keyType has the specified type
*/
protected boolean isKeyType(ReferenceStrength type) {
protected boolean isKeyType(final ReferenceStrength type) {
return this.keyType == type;
}
}

View File

@ -427,7 +427,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
return new LazyIteratorChain<Entry<K, V>>() {
@Override
protected Iterator<? extends Entry<K, V>> nextIterator(int count) {
protected Iterator<? extends Entry<K, V>> nextIterator(final int count) {
if ( ! keyIterator.hasNext() ) {
return null;
}
@ -445,7 +445,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
return input;
}
@Override
public V setValue(V value) {
public V setValue(final V value) {
throw new UnsupportedOperationException();
}
};
@ -564,7 +564,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
}
}
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
private void readObject(final ObjectInputStream is) throws IOException, ClassNotFoundException {
is.defaultReadObject();
// ensure that the de-serialized class is a Collection, COLLECTIONS-580
if (clazz != null && !Collection.class.isAssignableFrom(clazz)) {

View File

@ -96,7 +96,7 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
* unmodifiable list for no mapping found.
*/
@Override
public List<V> remove(Object key) {
public List<V> remove(final Object key) {
return ListUtils.emptyIfNull(getMap().remove(key));
}
@ -116,7 +116,7 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
}
@Override
public void add(int index, V value) {
public void add(final int index, final V value) {
List<V> list = getMapping();
if (list == null) {
list = createCollection();
@ -126,7 +126,7 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
}
@Override
public boolean addAll(int index, Collection<? extends V> c) {
public boolean addAll(final int index, final Collection<? extends V> c) {
List<V> list = getMapping();
if (list == null) {
list = createCollection();
@ -140,19 +140,19 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
}
@Override
public V get(int index) {
public V get(final int index) {
final List<V> list = ListUtils.emptyIfNull(getMapping());
return list.get(index);
}
@Override
public int indexOf(Object o) {
public int indexOf(final Object o) {
final List<V> list = ListUtils.emptyIfNull(getMapping());
return list.indexOf(o);
}
@Override
public int lastIndexOf(Object o) {
public int lastIndexOf(final Object o) {
final List<V> list = ListUtils.emptyIfNull(getMapping());
return list.lastIndexOf(o);
}
@ -163,12 +163,12 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
}
@Override
public ListIterator<V> listIterator(int index) {
public ListIterator<V> listIterator(final int index) {
return new ValuesListIterator(key, index);
}
@Override
public V remove(int index) {
public V remove(final int index) {
final List<V> list = ListUtils.emptyIfNull(getMapping());
V value = list.remove(index);
if (list.isEmpty()) {
@ -178,19 +178,19 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
}
@Override
public V set(int index, V value) {
public V set(final int index, final V value) {
final List<V> list = ListUtils.emptyIfNull(getMapping());
return list.set(index, value);
}
@Override
public List<V> subList(int fromIndex, int toIndex) {
public List<V> subList(final int fromIndex, final int toIndex) {
final List<V> list = ListUtils.emptyIfNull(getMapping());
return list.subList(fromIndex, toIndex);
}
@Override
public boolean equals(Object other) {
public boolean equals(final Object other) {
final List<V> list = getMapping();
if (list == null) {
return Collections.emptyList().equals(other);
@ -223,14 +223,14 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
this.iterator = values.listIterator();
}
public ValuesListIterator(final K key, int index) {
public ValuesListIterator(final K key, final int index) {
this.key = key;
this.values = ListUtils.emptyIfNull(getMap().get(key));
this.iterator = values.listIterator(index);
}
@Override
public void add(V value) {
public void add(final V value) {
if (getMap().get(key) == null) {
List<V> list = createCollection();
getMap().put(key, list);
@ -279,7 +279,7 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
}
@Override
public void set(V value) {
public void set(final V value) {
iterator.set(value);
}

View File

@ -109,7 +109,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
* @param map the map to wrap
*/
@SuppressWarnings("unchecked")
protected void setMap(Map<K, ? extends Collection<V>> map) {
protected void setMap(final Map<K, ? extends Collection<V>> map) {
this.map = (Map<K, Collection<V>>) map;
}
@ -117,7 +117,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
// -----------------------------------------------------------------------
@Override
public boolean containsKey(Object key) {
public boolean containsKey(final Object key) {
return getMap().containsKey(key);
}
@ -127,7 +127,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean containsMapping(Object key, Object value) {
public boolean containsMapping(final Object key, final Object value) {
Collection<V> coll = getMap().get(key);
return coll != null && coll.contains(value);
}
@ -163,7 +163,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
* empty, unmodifiable collection for no mapping found
*/
@Override
public Collection<V> remove(Object key) {
public Collection<V> remove(final Object key) {
return CollectionUtils.emptyIfNull(getMap().remove(key));
}
@ -370,7 +370,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean equals(Object obj) {
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
@ -415,7 +415,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean add(V value) {
public boolean add(final V value) {
Collection<V> coll = getMapping();
if (coll == null) {
coll = createCollection();
@ -425,7 +425,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean addAll(Collection<? extends V> other) {
public boolean addAll(final Collection<? extends V> other) {
Collection<V> coll = getMapping();
if (coll == null) {
coll = createCollection();
@ -460,13 +460,13 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean contains(Object obj) {
public boolean contains(final Object obj) {
final Collection<V> coll = getMapping();
return coll == null ? false : coll.contains(obj);
}
@Override
public boolean containsAll(Collection<?> other) {
public boolean containsAll(final Collection<?> other) {
final Collection<V> coll = getMapping();
return coll == null ? false : coll.containsAll(other);
}
@ -478,7 +478,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean remove(Object item) {
public boolean remove(final Object item) {
final Collection<V> coll = getMapping();
if (coll == null) {
return false;
@ -492,7 +492,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean removeAll(Collection<?> c) {
public boolean removeAll(final Collection<?> c) {
final Collection<V> coll = getMapping();
if (coll == null) {
return false;
@ -506,7 +506,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean retainAll(Collection<?> c) {
public boolean retainAll(final Collection<?> c) {
final Collection<V> coll = getMapping();
if (coll == null) {
return false;
@ -530,7 +530,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
@Override
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
public <T> T[] toArray(final T[] a) {
final Collection<V> coll = getMapping();
if (coll == null) {
return (T[]) CollectionUtils.EMPTY_COLLECTION.toArray(a);
@ -555,7 +555,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
private class KeysMultiSet extends AbstractMultiSet<K> {
@Override
public boolean contains(Object o) {
public boolean contains(final Object o) {
return getMap().containsKey(o);
}
@ -575,7 +575,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public int getCount(Object object) {
public int getCount(final Object object) {
int count = 0;
Collection<V> col = AbstractMultiValuedMap.this.getMap().get(object);
if (col != null) {
@ -622,7 +622,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
final Iterator<K> keyIterator = keysCol.iterator();
@Override
protected Iterator<? extends Entry<K, V>> nextIterator(int count) {
protected Iterator<? extends Entry<K, V>> nextIterator(final int count) {
if (!keyIterator.hasNext()) {
return null;
}
@ -652,12 +652,12 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
*/
private class MultiValuedMapEntry extends AbstractMapEntry<K, V> {
public MultiValuedMapEntry(K key, V value) {
public MultiValuedMapEntry(final K key, final V value) {
super(key, value);
}
@Override
public V setValue(V value) {
public V setValue(final V value) {
throw new UnsupportedOperationException();
}
@ -709,7 +709,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public V setValue(V value) {
public V setValue(final V value) {
if (current == null) {
throw new IllegalStateException();
}
@ -791,12 +791,12 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean containsKey(Object key) {
public boolean containsKey(final Object key) {
return decoratedMap.containsKey(key);
}
@Override
public Collection<V> get(Object key) {
public Collection<V> get(final Object key) {
Collection<V> collection = decoratedMap.get(key);
if (collection == null) {
return null;
@ -817,7 +817,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public Collection<V> remove(Object key) {
public Collection<V> remove(final Object key) {
Collection<V> collection = decoratedMap.remove(key);
if (collection == null) {
return null;
@ -830,7 +830,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean equals(Object object) {
public boolean equals(final Object object) {
return this == object || decoratedMap.equals(object);
}
@ -867,12 +867,12 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
}
@Override
public boolean contains(Object o) {
public boolean contains(final Object o) {
return decoratedMap.entrySet().contains(o);
}
@Override
public boolean remove(Object o) {
public boolean remove(final Object o) {
if (!contains(o)) {
return false;
}
@ -887,7 +887,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
*/
class AsMapEntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, Collection<V>>> {
AsMapEntrySetIterator(Iterator<Map.Entry<K, Collection<V>>> iterator) {
AsMapEntrySetIterator(final Iterator<Map.Entry<K, Collection<V>>> iterator) {
super(iterator);
}

View File

@ -117,7 +117,7 @@ public abstract class AbstractMultiValuedMapDecorator<K, V>
}
@Override
public boolean put(K key, V value) {
public boolean put(final K key, final V value) {
return decorated().put(key, value);
}
@ -147,17 +147,17 @@ public abstract class AbstractMultiValuedMapDecorator<K, V>
}
@Override
public boolean putAll(K key, Iterable<? extends V> values) {
public boolean putAll(final K key, final Iterable<? extends V> values) {
return decorated().putAll(key, values);
}
@Override
public boolean putAll(Map<? extends K, ? extends V> map) {
public boolean putAll(final Map<? extends K, ? extends V> map) {
return decorated().putAll(map);
}
@Override
public boolean putAll(MultiValuedMap<? extends K, ? extends V> map) {
public boolean putAll(final MultiValuedMap<? extends K, ? extends V> map) {
return decorated().putAll(map);
}

View File

@ -48,7 +48,7 @@ public abstract class AbstractSetValuedMap<K, V> extends AbstractMultiValuedMap<
* @param map the map to wrap, must not be null
* @throws NullPointerException if the map is null
*/
protected AbstractSetValuedMap(Map<K, ? extends Set<V>> map) {
protected AbstractSetValuedMap(final Map<K, ? extends Set<V>> map) {
super(map);
}
@ -95,7 +95,7 @@ public abstract class AbstractSetValuedMap<K, V> extends AbstractMultiValuedMap<
* unmodifiable set for no mapping found.
*/
@Override
public Set<V> remove(Object key) {
public Set<V> remove(final Object key) {
return SetUtils.emptyIfNull(getMap().remove(key));
}
@ -111,7 +111,7 @@ public abstract class AbstractSetValuedMap<K, V> extends AbstractMultiValuedMap<
}
@Override
public boolean equals(Object other) {
public boolean equals(final Object other) {
final Set<V> set = (Set<V>) getMapping();
if (set == null) {
return Collections.emptySet().equals(other);

View File

@ -74,7 +74,7 @@ public class ArrayListValuedHashMap<K, V> extends AbstractListValuedMap<K, V>
*
* @param initialListCapacity the initial capacity used for value collections
*/
public ArrayListValuedHashMap(int initialListCapacity) {
public ArrayListValuedHashMap(final int initialListCapacity) {
this(DEFAULT_INITIAL_MAP_CAPACITY, initialListCapacity);
}
@ -85,7 +85,7 @@ public class ArrayListValuedHashMap<K, V> extends AbstractListValuedMap<K, V>
* @param initialMapCapacity the initial hashmap capacity
* @param initialListCapacity the initial capacity used for value collections
*/
public ArrayListValuedHashMap(int initialMapCapacity, int initialListCapacity) {
public ArrayListValuedHashMap(final int initialMapCapacity, final int initialListCapacity) {
super(new HashMap<K, ArrayList<V>>(initialMapCapacity));
this.initialListCapacity = initialListCapacity;
}
@ -128,12 +128,12 @@ public class ArrayListValuedHashMap<K, V> extends AbstractListValuedMap<K, V>
}
// -----------------------------------------------------------------------
private void writeObject(ObjectOutputStream oos) throws IOException {
private void writeObject(final ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
doWriteObject(oos);
}
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
private void readObject(final ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
setMap(new HashMap<K, ArrayList<V>>());
doReadObject(ois);

View File

@ -73,7 +73,7 @@ public class HashSetValuedHashMap<K, V> extends AbstractSetValuedMap<K, V>
*
* @param initialSetCapacity the initial capacity used for value collections
*/
public HashSetValuedHashMap(int initialSetCapacity) {
public HashSetValuedHashMap(final int initialSetCapacity) {
this(DEFAULT_INITIAL_MAP_CAPACITY, initialSetCapacity);
}
@ -84,7 +84,7 @@ public class HashSetValuedHashMap<K, V> extends AbstractSetValuedMap<K, V>
* @param initialMapCapacity the initial hashmap capacity
* @param initialSetCapacity the initial capacity used for value collections
*/
public HashSetValuedHashMap(int initialMapCapacity, int initialSetCapacity) {
public HashSetValuedHashMap(final int initialMapCapacity, final int initialSetCapacity) {
super(new HashMap<K, HashSet<V>>(initialMapCapacity));
this.initialSetCapacity = initialSetCapacity;
}
@ -116,12 +116,12 @@ public class HashSetValuedHashMap<K, V> extends AbstractSetValuedMap<K, V>
}
// -----------------------------------------------------------------------
private void writeObject(ObjectOutputStream oos) throws IOException {
private void writeObject(final ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
doWriteObject(oos);
}
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
private void readObject(final ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
setMap(new HashMap<K, HashSet<V>>());
doReadObject(ois);

View File

@ -60,7 +60,7 @@ public final class UnmodifiableMultiValuedMap<K, V>
*/
@SuppressWarnings("unchecked")
public static <K, V> UnmodifiableMultiValuedMap<K, V> unmodifiableMultiValuedMap(
MultiValuedMap<? extends K, ? extends V> map) {
final MultiValuedMap<? extends K, ? extends V> map) {
if (map instanceof Unmodifiable) {
return (UnmodifiableMultiValuedMap<K, V>) map;
}

View File

@ -81,7 +81,7 @@ public abstract class AbstractMapMultiSet<E> extends AbstractMultiSet<E> {
*
* @param map the map to wrap
*/
protected void setMap(Map<E, MutableInteger> map) {
protected void setMap(final Map<E, MutableInteger> map) {
this.map = map;
}

View File

@ -257,7 +257,7 @@ public abstract class AbstractMultiSet<E> extends AbstractCollection<E> implemen
protected Iterator<E> createUniqueSetIterator() {
final Transformer<Entry<E>, E> transformer = new Transformer<Entry<E>, E>() {
@Override
public E transform(Entry<E> entry) {
public E transform(final Entry<E> entry) {
return entry.getElement();
}
};
@ -411,7 +411,7 @@ public abstract class AbstractMultiSet<E> extends AbstractCollection<E> implemen
protected static abstract class AbstractEntry<E> implements Entry<E> {
@Override
public boolean equals(Object object) {
public boolean equals(final Object object) {
if (object instanceof Entry) {
final Entry<?> other = (Entry<?>) object;
final E element = this.getElement();

View File

@ -79,7 +79,7 @@ public abstract class AbstractMultiSetDecorator<E>
}
@Override
public int setCount(E object, int count) {
public int setCount(final E object, final int count) {
return decorated().setCount(object, count);
}

View File

@ -118,7 +118,7 @@ public class PredicatedMultiSet<E> extends PredicatedCollection<E> implements Mu
}
@Override
public int setCount(E object, int count) {
public int setCount(final E object, final int count) {
validate(object);
return decorated().setCount(object, count);
}

View File

@ -120,7 +120,7 @@ public class SynchronizedMultiSet<E> extends SynchronizedCollection<E> implement
}
@Override
public int setCount(E object, int count) {
public int setCount(final E object, final int count) {
synchronized (lock) {
return decorated().setCount(object, count);
}

View File

@ -136,7 +136,7 @@ public final class UnmodifiableMultiSet<E>
//-----------------------------------------------------------------------
@Override
public int setCount(E object, int count) {
public int setCount(final E object, final int count) {
throw new UnsupportedOperationException();
}

View File

@ -282,7 +282,7 @@ public class CircularFifoQueue<E> extends AbstractCollection<E>
* @throws NullPointerException if the given element is null
*/
@Override
public boolean offer(E element) {
public boolean offer(final E element) {
return add(element);
}

View File

@ -64,22 +64,22 @@ public abstract class AbstractNavigableSetDecorator<E>
//-----------------------------------------------------------------------
@Override
public E lower(E e) {
public E lower(final E e) {
return decorated().lower(e);
}
@Override
public E floor(E e) {
public E floor(final E e) {
return decorated().floor(e);
}
@Override
public E ceiling(E e) {
public E ceiling(final E e) {
return decorated().ceiling(e);
}
@Override
public E higher(E e) {
public E higher(final E e) {
return decorated().higher(e);
}
@ -104,17 +104,17 @@ public abstract class AbstractNavigableSetDecorator<E>
}
@Override
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {
public NavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive) {
return decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
}
@Override
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
public NavigableSet<E> headSet(final E toElement, final boolean inclusive) {
return decorated().headSet(toElement, inclusive);
}
@Override
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
public NavigableSet<E> tailSet(final E fromElement, final boolean inclusive) {
return decorated().tailSet(fromElement, inclusive);
}

View File

@ -91,22 +91,22 @@ public class PredicatedNavigableSet<E> extends PredicatedSortedSet<E> implements
//-----------------------------------------------------------------------
@Override
public E lower(E e) {
public E lower(final E e) {
return decorated().lower(e);
}
@Override
public E floor(E e) {
public E floor(final E e) {
return decorated().floor(e);
}
@Override
public E ceiling(E e) {
public E ceiling(final E e) {
return decorated().ceiling(e);
}
@Override
public E higher(E e) {
public E higher(final E e) {
return decorated().higher(e);
}
@ -131,19 +131,19 @@ public class PredicatedNavigableSet<E> extends PredicatedSortedSet<E> implements
}
@Override
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {
public NavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive) {
final NavigableSet<E> sub = decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
return predicatedNavigableSet(sub, predicate);
}
@Override
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
public NavigableSet<E> headSet(final E toElement, final boolean inclusive) {
final NavigableSet<E> head = decorated().headSet(toElement, inclusive);
return predicatedNavigableSet(head, predicate);
}
@Override
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
public NavigableSet<E> tailSet(final E fromElement, final boolean inclusive) {
final NavigableSet<E> tail = decorated().tailSet(fromElement, inclusive);
return predicatedNavigableSet(tail, predicate);
}

View File

@ -112,22 +112,22 @@ public class TransformedNavigableSet<E> extends TransformedSortedSet<E> implemen
//-----------------------------------------------------------------------
@Override
public E lower(E e) {
public E lower(final E e) {
return decorated().lower(e);
}
@Override
public E floor(E e) {
public E floor(final E e) {
return decorated().floor(e);
}
@Override
public E ceiling(E e) {
public E ceiling(final E e) {
return decorated().ceiling(e);
}
@Override
public E higher(E e) {
public E higher(final E e) {
return decorated().higher(e);
}
@ -152,19 +152,19 @@ public class TransformedNavigableSet<E> extends TransformedSortedSet<E> implemen
}
@Override
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {
public NavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive) {
final NavigableSet<E> sub = decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
return transformingNavigableSet(sub, transformer);
}
@Override
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
public NavigableSet<E> headSet(final E toElement, final boolean inclusive) {
final NavigableSet<E> head = decorated().headSet(toElement, inclusive);
return transformingNavigableSet(head, transformer);
}
@Override
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
public NavigableSet<E> tailSet(final E fromElement, final boolean inclusive) {
final NavigableSet<E> tail = decorated().tailSet(fromElement, inclusive);
return transformingNavigableSet(tail, transformer);
}

View File

@ -136,19 +136,19 @@ public final class UnmodifiableNavigableSet<E>
}
@Override
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {
public NavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive) {
final NavigableSet<E> sub = decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
return unmodifiableNavigableSet(sub);
}
@Override
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
public NavigableSet<E> headSet(final E toElement, final boolean inclusive) {
final NavigableSet<E> head = decorated().headSet(toElement, inclusive);
return unmodifiableNavigableSet(head);
}
@Override
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
public NavigableSet<E> tailSet(final E fromElement, final boolean inclusive) {
final NavigableSet<E> tail = decorated().tailSet(fromElement, inclusive);
return unmodifiableNavigableSet(tail);
}

View File

@ -180,12 +180,12 @@ public class UnmodifiableTrie<K, V> implements Trie<K, V>, Serializable, Unmodif
}
@Override
public K nextKey(K key) {
public K nextKey(final K key) {
return delegate.nextKey(key);
}
@Override
public K previousKey(K key) {
public K previousKey(final K key) {
return delegate.previousKey(key);
}

View File

@ -702,7 +702,7 @@ public class CollectionUtilsTest extends MockTestCase {
final StringBuffer result = new StringBuffer();
result.append(CollectionUtils.forAllButLastDo(strings, new Closure<String>() {
@Override
public void execute(String input) {
public void execute(final String input) {
result.append(input+";");
}
}));
@ -712,7 +712,7 @@ public class CollectionUtilsTest extends MockTestCase {
final StringBuffer resultOne = new StringBuffer();
resultOne.append(CollectionUtils.forAllButLastDo(oneString, new Closure<String>() {
@Override
public void execute(String input) {
public void execute(final String input) {
resultOne.append(input+";");
}
}));
@ -1800,7 +1800,7 @@ public class CollectionUtilsTest extends MockTestCase {
Predicate<Integer> lessThanFive = new Predicate<Integer>() {
@Override
public boolean evaluate(Integer object) {
public boolean evaluate(final Integer object) {
return object < 5;
}
};
@ -1808,7 +1808,7 @@ public class CollectionUtilsTest extends MockTestCase {
Predicate<Integer> lessThanFour = new Predicate<Integer>() {
@Override
public boolean evaluate(Integer object) {
public boolean evaluate(final Integer object) {
return object < 4;
}
};
@ -1834,12 +1834,12 @@ public class CollectionUtilsTest extends MockTestCase {
final Collection<String> result = CollectionUtils.removeAll(base, remove, new Equator<String>() {
@Override
public boolean equate(String o1, String o2) {
public boolean equate(final String o1, final String o2) {
return o1.charAt(1) == o2.charAt(1);
}
@Override
public int hash(String o) {
public int hash(final String o) {
return o.charAt(1);
}
});
@ -1886,12 +1886,12 @@ public class CollectionUtilsTest extends MockTestCase {
final Collection<String> result = CollectionUtils.retainAll(base, retain, new Equator<String>() {
@Override
public boolean equate(String o1, String o2) {
public boolean equate(final String o1, final String o2) {
return o1.charAt(1) == o2.charAt(1);
}
@Override
public int hash(String o) {
public int hash(final String o) {
return o.charAt(1);
}
});

View File

@ -200,7 +200,7 @@ public class FluentIterableTest {
public void filter() {
Predicate<Integer> smallerThan3 = new Predicate<Integer>() {
@Override
public boolean evaluate(Integer object) {
public boolean evaluate(final Integer object) {
return object.intValue() < 3;
}
};
@ -225,7 +225,7 @@ public class FluentIterableTest {
final AtomicInteger sum = new AtomicInteger(0);
Closure<Integer> closure = new Closure<Integer>() {
@Override
public void execute(Integer input) {
public void execute(final Integer input) {
sum.addAndGet(input);
}
};
@ -317,7 +317,7 @@ public class FluentIterableTest {
public void transform() {
Transformer<Integer, Integer> squared = new Transformer<Integer, Integer>() {
@Override
public Integer transform(Integer object) {
public Integer transform(final Integer object) {
return object * object;
}
};

View File

@ -184,12 +184,12 @@ public class IterableUtilsTest {
final Equator<String> secondLetterEquator = new Equator<String>() {
@Override
public boolean equate(String o1, String o2) {
public boolean equate(final String o1, final String o2) {
return o1.charAt(1) == o2.charAt(1);
}
@Override
public int hash(String o) {
public int hash(final String o) {
return o.charAt(1);
}
@ -375,7 +375,7 @@ public class IterableUtilsTest {
Predicate<Integer> lessThanFive = new Predicate<Integer>() {
@Override
public boolean evaluate(Integer object) {
public boolean evaluate(final Integer object) {
return object < 5;
}
};
@ -383,7 +383,7 @@ public class IterableUtilsTest {
Predicate<Integer> lessThanFour = new Predicate<Integer>() {
@Override
public boolean evaluate(Integer object) {
public boolean evaluate(final Integer object) {
return object < 4;
}
};
@ -487,7 +487,7 @@ public class IterableUtilsTest {
result = IterableUtils.toString(iterableA, new Transformer<Integer, String>() {
@Override
public String transform(Integer input) {
public String transform(final Integer input) {
return new Integer(input * 2).toString();
}
});
@ -495,7 +495,7 @@ public class IterableUtilsTest {
result = IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
@Override
public String transform(Integer input) {
public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@ -504,7 +504,7 @@ public class IterableUtilsTest {
result = IterableUtils.toString(null, new Transformer<Integer, String>() {
@Override
public String transform(Integer input) {
public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@ -517,7 +517,7 @@ public class IterableUtilsTest {
Transformer<Integer, String> transformer = new Transformer<Integer, String>() {
@Override
public String transform(Integer input) {
public String transform(final Integer input) {
return new Integer(input * 2).toString();
}
};
@ -554,7 +554,7 @@ public class IterableUtilsTest {
public void testToStringWithNullArguments() {
String result = IterableUtils.toString(null, new Transformer<Integer, String>() {
@Override
public String transform(Integer input) {
public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@ -571,7 +571,7 @@ public class IterableUtilsTest {
try {
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
@Override
public String transform(Integer input) {
public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@ -584,7 +584,7 @@ public class IterableUtilsTest {
try {
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
@Override
public String transform(Integer input) {
public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@ -597,7 +597,7 @@ public class IterableUtilsTest {
try {
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
@Override
public String transform(Integer input) {
public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}

View File

@ -824,13 +824,13 @@ public class MapUtilsTest {
int key;
String name;
public X(int key, String name) {
public X(final int key, final String name) {
this.key = key;
this.name = name;
}
@Override
public int compareTo(X o) {
public int compareTo(final X o) {
return key - o.key | name.compareTo(o.name);
}
@ -850,7 +850,7 @@ public class MapUtilsTest {
final MultiValueMap<Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<Integer, Collection<X>>());
MapUtils.populateMap(map, list, new Transformer<X, Integer>() {
@Override
public Integer transform(X input) {
public Integer transform(final X input) {
return input.key;
}
}, TransformerUtils.<X> nopTransformer());

View File

@ -249,7 +249,7 @@ public class TransformerUtilsTest {
Predicate<Integer> lessThanFivePredicate = new Predicate<Integer>() {
@Override
public boolean evaluate(Integer value) {
public boolean evaluate(final Integer value) {
return value < 5;
}
};

View File

@ -77,7 +77,7 @@ public class TreeBagTest<T> extends AbstractSortedBagTest<T> {
final Bag<String> bag2 = new TreeBag<>(new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
public int compare(final String o1, final String o2) {
return o1.compareTo(o2);
}
});

View File

@ -137,7 +137,7 @@ public class PredicatedCollectionBuilderTest {
private static class OddPredicate implements Predicate<Integer> {
@Override
public boolean evaluate(Integer value) {
public boolean evaluate(final Integer value) {
return value % 2 == 1;
}
}

View File

@ -134,7 +134,7 @@ public class PeekingIteratorTest<E> extends AbstractIteratorTest<E> {
}
}
private void validate(Iterator<E> iter, E... items) {
private void validate(final Iterator<E> iter, final E... items) {
for (E x : items) {
assertTrue(iter.hasNext());
assertEquals(x, iter.next());

View File

@ -109,7 +109,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> {
validate(iter, "c");
}
private void validate(Iterator<E> iter, Object... items) {
private void validate(final Iterator<E> iter, final Object... items) {
for (final Object x : items) {
assertTrue(iter.hasNext());
assertEquals(x, iter.next());

View File

@ -258,7 +258,7 @@ public class MultiKeyTest extends TestCase {
private static final long serialVersionUID = 1928896152249821416L;
public DerivedMultiKey(T key1, T key2) {
public DerivedMultiKey(final T key1, final T key2) {
super(key1, key2);
}

View File

@ -407,7 +407,7 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
}
}
private byte[] serialize(Object object) throws IOException {
private byte[] serialize(final Object object) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
@ -417,7 +417,7 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
return baos.toByteArray();
}
private Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
private Object deserialize(final byte[] data) throws IOException, ClassNotFoundException {
ByteArrayInputStream bais = new ByteArrayInputStream(data);
ObjectInputStream iis = new ObjectInputStream(bais);

View File

@ -234,7 +234,7 @@ public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> {
new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<String, String>(1, TimeUnit.SECONDS)), 1000);
}
private void validateExpiration(final Map<String, String> map, long timeout) {
private void validateExpiration(final Map<String, String> map, final long timeout) {
map.put("a", "b");
assertNotNull(map.get("a"));

View File

@ -57,7 +57,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
/** MultiValuedHashMap created by reset(). */
protected MultiValuedMap<K, V> confirmed;
public AbstractMultiValuedMapTest(String testName) {
public AbstractMultiValuedMapTest(final String testName) {
super(testName);
}
@ -146,7 +146,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
return map;
}
protected void addSampleMappings(MultiValuedMap<? super K, ? super V> map) {
protected void addSampleMappings(final MultiValuedMap<? super K, ? super V> map) {
final K[] keys = getSampleKeys();
final V[] values = getSampleValues();
for (int i = 0; i < keys.length; i++) {
@ -168,7 +168,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
return this.confirmed;
}
public void setConfirmed(MultiValuedMap<K, V> map) {
public void setConfirmed(final MultiValuedMap<K, V> map) {
this.confirmed = map;
}

View File

@ -32,7 +32,7 @@ import org.apache.commons.collections4.MultiValuedMap;
*/
public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
public ArrayListValuedHashMapTest(String testName) {
public ArrayListValuedHashMapTest(final String testName) {
super(testName);
}

View File

@ -32,7 +32,7 @@ import org.apache.commons.collections4.SetValuedMap;
*/
public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
public HashSetValuedHashMapTest(String testName) {
public HashSetValuedHashMapTest(final String testName) {
super(testName);
}

View File

@ -33,7 +33,7 @@ import org.apache.commons.collections4.collection.TransformedCollectionTest;
*/
public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
public TransformedMultiValuedMapTest(String testName) {
public TransformedMultiValuedMapTest(final String testName) {
super(testName);
}

View File

@ -38,7 +38,7 @@ import org.apache.commons.collections4.Unmodifiable;
*/
public class UnmodifiableMultiValuedMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
public UnmodifiableMultiValuedMapTest(String testName) {
public UnmodifiableMultiValuedMapTest(final String testName) {
super(testName);
}