You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2013/01/07 18:15:24 UTC
svn commit: r1429905 [3/26] - in /commons/proper/collections/trunk/src:
main/java/org/apache/commons/collections/
main/java/org/apache/commons/collections/bag/
main/java/org/apache/commons/collections/bidimap/
main/java/org/apache/commons/collections/b...
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/IteratorUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/IteratorUtils.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/IteratorUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/IteratorUtils.java Mon Jan 7 17:15:14 2013
@@ -193,7 +193,7 @@ public class IteratorUtils {
* @param object the single object over which to iterate
* @return a singleton iterator over the object
*/
- public static <E> ResettableIterator<E> singletonIterator(E object) {
+ public static <E> ResettableIterator<E> singletonIterator(final E object) {
return new SingletonIterator<E>(object);
}
@@ -206,7 +206,7 @@ public class IteratorUtils {
* @param object the single object over which to iterate
* @return a singleton list iterator over the object
*/
- public static <E> ListIterator<E> singletonListIterator(E object) {
+ public static <E> ListIterator<E> singletonListIterator(final E object) {
return new SingletonListIterator<E>(object);
}
@@ -222,7 +222,7 @@ public class IteratorUtils {
* @return an iterator over the array
* @throws NullPointerException if array is null
*/
- public static <E> ResettableIterator<E> arrayIterator(E[] array) {
+ public static <E> ResettableIterator<E> arrayIterator(final E[] array) {
return new ObjectArrayIterator<E>(array);
}
@@ -237,7 +237,7 @@ public class IteratorUtils {
* @throws IllegalArgumentException if the array is not an array
* @throws NullPointerException if array is null
*/
- public static <E> ResettableIterator<E> arrayIterator(Object array) {
+ public static <E> ResettableIterator<E> arrayIterator(final Object array) {
return new ArrayIterator<E>(array);
}
@@ -254,7 +254,7 @@ public class IteratorUtils {
* than the length of the array
* @throws NullPointerException if array is null
*/
- public static <E> ResettableIterator<E> arrayIterator(E[] array, int start) {
+ public static <E> ResettableIterator<E> arrayIterator(final E[] array, final int start) {
return new ObjectArrayIterator<E>(array, start);
}
@@ -272,7 +272,7 @@ public class IteratorUtils {
* than the length of the array
* @throws NullPointerException if array is null
*/
- public static <E> ResettableIterator<E> arrayIterator(Object array, int start) {
+ public static <E> ResettableIterator<E> arrayIterator(final Object array, final int start) {
return new ArrayIterator<E>(array, start);
}
@@ -290,7 +290,7 @@ public class IteratorUtils {
* @throws IllegalArgumentException if end is before start
* @throws NullPointerException if array is null
*/
- public static <E> ResettableIterator<E> arrayIterator(E[] array, int start, int end) {
+ public static <E> ResettableIterator<E> arrayIterator(final E[] array, final int start, final int end) {
return new ObjectArrayIterator<E>(array, start, end);
}
@@ -309,7 +309,7 @@ public class IteratorUtils {
* @throws IllegalArgumentException if end is before start
* @throws NullPointerException if array is null
*/
- public static <E> ResettableIterator<E> arrayIterator(Object array, int start, int end) {
+ public static <E> ResettableIterator<E> arrayIterator(final Object array, final int start, final int end) {
return new ArrayIterator<E>(array, start, end);
}
@@ -321,7 +321,7 @@ public class IteratorUtils {
* @return a list iterator over the array
* @throws NullPointerException if array is null
*/
- public static <E> ResettableListIterator<E> arrayListIterator(E[] array) {
+ public static <E> ResettableListIterator<E> arrayListIterator(final E[] array) {
return new ObjectArrayListIterator<E>(array);
}
@@ -336,7 +336,7 @@ public class IteratorUtils {
* @throws IllegalArgumentException if the array is not an array
* @throws NullPointerException if array is null
*/
- public static <E> ResettableListIterator<E> arrayListIterator(Object array) {
+ public static <E> ResettableListIterator<E> arrayListIterator(final Object array) {
return new ArrayListIterator<E>(array);
}
@@ -349,7 +349,7 @@ public class IteratorUtils {
* @throws IndexOutOfBoundsException if start is less than zero
* @throws NullPointerException if array is null
*/
- public static <E> ResettableListIterator<E> arrayListIterator(E[] array, int start) {
+ public static <E> ResettableListIterator<E> arrayListIterator(final E[] array, final int start) {
return new ObjectArrayListIterator<E>(array, start);
}
@@ -366,7 +366,7 @@ public class IteratorUtils {
* @throws IndexOutOfBoundsException if start is less than zero
* @throws NullPointerException if array is null
*/
- public static <E> ResettableListIterator<E> arrayListIterator(Object array, int start) {
+ public static <E> ResettableListIterator<E> arrayListIterator(final Object array, final int start) {
return new ArrayListIterator<E>(array, start);
}
@@ -381,7 +381,7 @@ public class IteratorUtils {
* @throws IllegalArgumentException if end is before start
* @throws NullPointerException if array is null
*/
- public static <E> ResettableListIterator<E> arrayListIterator(E[] array, int start, int end) {
+ public static <E> ResettableListIterator<E> arrayListIterator(final E[] array, final int start, final int end) {
return new ObjectArrayListIterator<E>(array, start, end);
}
@@ -400,7 +400,7 @@ public class IteratorUtils {
* @throws IllegalArgumentException if end is before start
* @throws NullPointerException if array is null
*/
- public static <E> ResettableListIterator<E> arrayListIterator(Object array, int start, int end) {
+ public static <E> ResettableListIterator<E> arrayListIterator(final Object array, final int start, final int end) {
return new ArrayListIterator<E>(array, start, end);
}
@@ -414,7 +414,7 @@ public class IteratorUtils {
* @param iterator the iterator to make immutable
* @return an immutable version of the iterator
*/
- public static <E> Iterator<E> unmodifiableIterator(Iterator<E> iterator) {
+ public static <E> Iterator<E> unmodifiableIterator(final Iterator<E> iterator) {
return UnmodifiableIterator.unmodifiableIterator(iterator);
}
@@ -427,7 +427,7 @@ public class IteratorUtils {
* @param listIterator the iterator to make immutable
* @return an immutable version of the iterator
*/
- public static <E> ListIterator<E> unmodifiableListIterator(ListIterator<E> listIterator) {
+ public static <E> ListIterator<E> unmodifiableListIterator(final ListIterator<E> listIterator) {
return UnmodifiableListIterator.umodifiableListIterator(listIterator);
}
@@ -439,7 +439,7 @@ public class IteratorUtils {
* @param mapIterator the iterator to make immutable
* @return an immutable version of the iterator
*/
- public static <K, V> MapIterator<K, V> unmodifiableMapIterator(MapIterator<K, V> mapIterator) {
+ public static <K, V> MapIterator<K, V> unmodifiableMapIterator(final MapIterator<K, V> mapIterator) {
return UnmodifiableMapIterator.unmodifiableMapIterator(mapIterator);
}
@@ -454,7 +454,7 @@ public class IteratorUtils {
* @return a combination iterator over the iterators
* @throws NullPointerException if either iterator is null
*/
- public static <E> Iterator<E> chainedIterator(Iterator<? extends E> iterator1, Iterator<? extends E> iterator2) {
+ public static <E> Iterator<E> chainedIterator(final Iterator<? extends E> iterator1, final Iterator<? extends E> iterator2) {
return new IteratorChain<E>(iterator1, iterator2);
}
@@ -466,7 +466,7 @@ public class IteratorUtils {
* @return a combination iterator over the iterators
* @throws NullPointerException if iterators array is null or contains a null
*/
- public static <E> Iterator<E> chainedIterator(Iterator<? extends E>[] iterators) {
+ public static <E> Iterator<E> chainedIterator(final Iterator<? extends E>[] iterators) {
return new IteratorChain<E>(iterators);
}
@@ -479,7 +479,7 @@ public class IteratorUtils {
* @throws NullPointerException if iterators collection is null or contains a null
* @throws ClassCastException if the iterators collection contains the wrong object type
*/
- public static <E> Iterator<E> chainedIterator(Collection<Iterator<? extends E>> iterators) {
+ public static <E> Iterator<E> chainedIterator(final Collection<Iterator<? extends E>> iterators) {
return new IteratorChain<E>(iterators);
}
@@ -501,7 +501,7 @@ public class IteratorUtils {
* @return a combination iterator over the iterators
* @throws NullPointerException if either iterator is null
*/
- public static <E> Iterator<E> collatedIterator(Comparator<? super E> comparator, Iterator<? extends E> iterator1, Iterator<? extends E> iterator2) {
+ public static <E> Iterator<E> collatedIterator(final Comparator<? super E> comparator, final Iterator<? extends E> iterator1, final Iterator<? extends E> iterator2) {
return new CollatingIterator<E>(comparator, iterator1, iterator2);
}
@@ -520,7 +520,7 @@ public class IteratorUtils {
* @return a combination iterator over the iterators
* @throws NullPointerException if iterators array is null or contains a null
*/
- public static <E> Iterator<E> collatedIterator(Comparator<? super E> comparator, Iterator<? extends E>[] iterators) {
+ public static <E> Iterator<E> collatedIterator(final Comparator<? super E> comparator, final Iterator<? extends E>[] iterators) {
return new CollatingIterator<E>(comparator, iterators);
}
@@ -540,8 +540,8 @@ public class IteratorUtils {
* @throws NullPointerException if iterators collection is null or contains a null
* @throws ClassCastException if the iterators collection contains the wrong object type
*/
- public static <E> Iterator<E> collatedIterator(Comparator<? super E> comparator,
- Collection<Iterator<? extends E>> iterators) {
+ public static <E> Iterator<E> collatedIterator(final Comparator<? super E> comparator,
+ final Collection<Iterator<? extends E>> iterators) {
return new CollatingIterator<E>(comparator, iterators);
}
@@ -600,7 +600,7 @@ public class IteratorUtils {
* @return a new object graph iterator
* @since 3.1
*/
- public static <E> Iterator<E> objectGraphIterator(E root, Transformer<? super E, ? extends E> transformer) {
+ public static <E> Iterator<E> objectGraphIterator(final E root, final Transformer<? super E, ? extends E> transformer) {
return new ObjectGraphIterator<E>(root, transformer);
}
@@ -617,7 +617,7 @@ public class IteratorUtils {
* @return a new transforming iterator
* @throws NullPointerException if either parameter is null
*/
- public static <I, O> Iterator<O> transformedIterator(Iterator<? extends I> iterator, Transformer<? super I, ? extends O> transform) {
+ public static <I, O> Iterator<O> transformedIterator(final Iterator<? extends I> iterator, final Transformer<? super I, ? extends O> transform) {
if (iterator == null) {
throw new NullPointerException("Iterator must not be null");
}
@@ -640,7 +640,7 @@ public class IteratorUtils {
* @return a new filtered iterator
* @throws NullPointerException if either parameter is null
*/
- public static <E> Iterator<E> filteredIterator(Iterator<? extends E> iterator, Predicate<? super E> predicate) {
+ public static <E> Iterator<E> filteredIterator(final Iterator<? extends E> iterator, final Predicate<? super E> predicate) {
if (iterator == null) {
throw new NullPointerException("Iterator must not be null");
}
@@ -661,7 +661,7 @@ public class IteratorUtils {
* @return a new filtered iterator
* @throws NullPointerException if either parameter is null
*/
- public static <E> ListIterator<E> filteredListIterator(ListIterator<? extends E> listIterator, Predicate<? super E> predicate) {
+ public static <E> ListIterator<E> filteredListIterator(final ListIterator<? extends E> listIterator, final Predicate<? super E> predicate) {
if (listIterator == null) {
throw new NullPointerException("ListIterator must not be null");
}
@@ -684,7 +684,7 @@ public class IteratorUtils {
* @return a new looping iterator
* @throws NullPointerException if the collection is null
*/
- public static <E> ResettableIterator<E> loopingIterator(Collection<? extends E> coll) {
+ public static <E> ResettableIterator<E> loopingIterator(final Collection<? extends E> coll) {
if (coll == null) {
throw new NullPointerException("Collection must not be null");
}
@@ -702,7 +702,7 @@ public class IteratorUtils {
* @throws NullPointerException if the list is null
* @since 3.2
*/
- public static <E> ResettableListIterator<E> loopingListIterator(List<E> list) {
+ public static <E> ResettableListIterator<E> loopingListIterator(final List<E> list) {
if (list == null) {
throw new NullPointerException("List must not be null");
}
@@ -717,7 +717,7 @@ public class IteratorUtils {
* @param enumeration the enumeration to use
* @return a new iterator
*/
- public static <E> Iterator<E> asIterator(Enumeration<? extends E> enumeration) {
+ public static <E> Iterator<E> asIterator(final Enumeration<? extends E> enumeration) {
if (enumeration == null) {
throw new NullPointerException("Enumeration must not be null");
}
@@ -732,7 +732,7 @@ public class IteratorUtils {
* @param removeCollection the collection to remove elements from
* @return a new iterator
*/
- public static <E> Iterator<E> asIterator(Enumeration<? extends E> enumeration, Collection<? super E> removeCollection) {
+ public static <E> Iterator<E> asIterator(final Enumeration<? extends E> enumeration, final Collection<? super E> removeCollection) {
if (enumeration == null) {
throw new NullPointerException("Enumeration must not be null");
}
@@ -749,7 +749,7 @@ public class IteratorUtils {
* @return a new enumeration
* @throws NullPointerException if iterator is null
*/
- public static <E> Enumeration<E> asEnumeration(Iterator<? extends E> iterator) {
+ public static <E> Enumeration<E> asEnumeration(final Iterator<? extends E> iterator) {
if (iterator == null) {
throw new NullPointerException("Iterator must not be null");
}
@@ -764,7 +764,7 @@ public class IteratorUtils {
* @return a new, single use iterable
* @throws NullPointerException if iterator is null
*/
- public static <E> Iterable<E> asIterable(Iterator<? extends E> iterator) {
+ public static <E> Iterable<E> asIterable(final Iterator<? extends E> iterator) {
if (iterator == null) {
throw new NullPointerException("Iterator must not be null");
}
@@ -779,7 +779,7 @@ public class IteratorUtils {
* @return a new, multiple use iterable
* @throws NullPointerException if iterator is null
*/
- public static <E> Iterable<E> asMultipleUseIterable(Iterator<? extends E> iterator) {
+ public static <E> Iterable<E> asMultipleUseIterable(final Iterator<? extends E> iterator) {
if (iterator == null) {
throw new NullPointerException("Iterator must not be null");
}
@@ -796,7 +796,7 @@ public class IteratorUtils {
* @return a new iterator
* @throws NullPointerException if iterator parameter is null
*/
- public static <E> ListIterator<E> toListIterator(Iterator<? extends E> iterator) {
+ public static <E> ListIterator<E> toListIterator(final Iterator<? extends E> iterator) {
if (iterator == null) {
throw new NullPointerException("Iterator must not be null");
}
@@ -813,11 +813,11 @@ public class IteratorUtils {
* @return an array of the iterator contents
* @throws NullPointerException if iterator parameter is null
*/
- public static Object[] toArray(Iterator<?> iterator) {
+ public static Object[] toArray(final Iterator<?> iterator) {
if (iterator == null) {
throw new NullPointerException("Iterator must not be null");
}
- List<?> list = toList(iterator, 100);
+ final List<?> list = toList(iterator, 100);
return list.toArray();
}
@@ -835,14 +835,14 @@ public class IteratorUtils {
* @throws ClassCastException if the arrayClass is invalid
*/
@SuppressWarnings("unchecked")
- public static <E> E[] toArray(Iterator<? extends E> iterator, Class<E> arrayClass) {
+ public static <E> E[] toArray(final Iterator<? extends E> iterator, final Class<E> arrayClass) {
if (iterator == null) {
throw new NullPointerException("Iterator must not be null");
}
if (arrayClass == null) {
throw new NullPointerException("Array class must not be null");
}
- List<E> list = toList(iterator, 100);
+ final List<E> list = toList(iterator, 100);
return list.toArray((E[]) Array.newInstance(arrayClass, list.size()));
}
@@ -856,7 +856,7 @@ public class IteratorUtils {
* @return a list of the iterator contents
* @throws NullPointerException if iterator parameter is null
*/
- public static <E> List<E> toList(Iterator<? extends E> iterator) {
+ public static <E> List<E> toList(final Iterator<? extends E> iterator) {
return toList(iterator, 10);
}
@@ -872,14 +872,14 @@ public class IteratorUtils {
* @throws NullPointerException if iterator parameter is null
* @throws IllegalArgumentException if the size is less than 1
*/
- public static <E> List<E> toList(Iterator<? extends E> iterator, int estimatedSize) {
+ public static <E> List<E> toList(final Iterator<? extends E> iterator, final int estimatedSize) {
if (iterator == null) {
throw new NullPointerException("Iterator must not be null");
}
if (estimatedSize < 1) {
throw new IllegalArgumentException("Estimated size must be greater than 0");
}
- List<E> list = new ArrayList<E>(estimatedSize);
+ final List<E> list = new ArrayList<E>(estimatedSize);
while (iterator.hasNext()) {
list.add(iterator.next());
}
@@ -905,7 +905,7 @@ public class IteratorUtils {
* @param obj the object to convert to an iterator
* @return a suitable iterator, never null
*/
- public static Iterator<?> getIterator(Object obj) {
+ public static Iterator<?> getIterator(final Object obj) {
if (obj == null) {
return emptyIterator();
}
@@ -930,20 +930,20 @@ public class IteratorUtils {
return new ArrayIterator<Object>(obj);
}
try {
- Method method = obj.getClass().getMethod("iterator", (Class[]) null);
+ final Method method = obj.getClass().getMethod("iterator", (Class[]) null);
if (Iterator.class.isAssignableFrom(method.getReturnType())) {
- Iterator<?> it = (Iterator<?>) method.invoke(obj, (Object[]) null);
+ final Iterator<?> it = (Iterator<?>) method.invoke(obj, (Object[]) null);
if (it != null) {
return it;
}
}
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
// ignore
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
// ignore
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
// ignore
- } catch (InvocationTargetException e) {
+ } catch (final InvocationTargetException e) {
// ignore
}
return singletonIterator(obj);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/ListUtils.java Mon Jan 7 17:15:14 2013
@@ -63,7 +63,7 @@ public class ListUtils {
* @param list the list, possibly <code>null</code>
* @return an empty list if the argument is <code>null</code>
*/
- public static <T> List<T> emptyIfNull(List<T> list) {
+ public static <T> List<T> emptyIfNull(final List<T> list) {
return list == null ? Collections.<T>emptyList() : list;
}
@@ -87,9 +87,9 @@ public class ListUtils {
larger = list1;
}
- HashSet<E> hashSet = new HashSet<E>(smaller);
+ final HashSet<E> hashSet = new HashSet<E>(smaller);
- for (E e : larger) {
+ for (final E e : larger) {
if (hashSet.contains(e)) {
result.add(e);
hashSet.remove(e);
@@ -174,8 +174,8 @@ public class ListUtils {
* @since 4.0
* @see CollectionUtils#select(Collection, Predicate)
*/
- public static <E> List<E> select(Collection<? extends E> inputCollection,
- Predicate<? super E> predicate) {
+ public static <E> List<E> select(final Collection<? extends E> inputCollection,
+ final Predicate<? super E> predicate) {
return CollectionUtils.select(inputCollection, predicate, new ArrayList<E>(inputCollection.size()));
}
@@ -198,8 +198,8 @@ public class ListUtils {
* @since 4.0
* @see CollectionUtils#selectRejected(Collection, Predicate)
*/
- public static <E> List<E> selectRejected(Collection<? extends E> inputCollection,
- Predicate<? super E> predicate) {
+ public static <E> List<E> selectRejected(final Collection<? extends E> inputCollection,
+ final Predicate<? super E> predicate) {
return CollectionUtils.selectRejected(inputCollection, predicate, new ArrayList<E>(inputCollection.size()));
}
@@ -240,8 +240,8 @@ public class ListUtils {
return false;
}
- Iterator<?> it1 = list1.iterator();
- Iterator<?> it2 = list2.iterator();
+ final Iterator<?> it1 = list1.iterator();
+ final Iterator<?> it2 = list2.iterator();
Object obj1 = null;
Object obj2 = null;
@@ -274,10 +274,10 @@ public class ListUtils {
return 0;
}
int hashCode = 1;
- Iterator<?> it = list.iterator();
+ final Iterator<?> it = list.iterator();
while (it.hasNext()) {
- Object obj = it.next();
+ final Object obj = it.next();
hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode());
}
return hashCode;
@@ -306,10 +306,10 @@ public class ListUtils {
* @throws NullPointerException if either parameter is null
* @since 3.2
*/
- public static <E> List<E> retainAll(Collection<E> collection, Collection<?> retain) {
- List<E> list = new ArrayList<E>(Math.min(collection.size(), retain.size()));
+ public static <E> List<E> retainAll(final Collection<E> collection, final Collection<?> retain) {
+ final List<E> list = new ArrayList<E>(Math.min(collection.size(), retain.size()));
- for (E obj : collection) {
+ for (final E obj : collection) {
if (retain.contains(obj)) {
list.add(obj);
}
@@ -340,9 +340,9 @@ public class ListUtils {
* @throws NullPointerException if either parameter is null
* @since 3.2
*/
- public static <E> List<E> removeAll(Collection<E> collection, Collection<?> remove) {
- List<E> list = new ArrayList<E>();
- for (E obj : collection) {
+ public static <E> List<E> removeAll(final Collection<E> collection, final Collection<?> remove) {
+ final List<E> list = new ArrayList<E>();
+ for (final E obj : collection) {
if (!remove.contains(obj)) {
list.add(obj);
}
@@ -374,7 +374,7 @@ public class ListUtils {
* @return a synchronized list backed by the given list
* @throws IllegalArgumentException if the list is null
*/
- public static <E> List<E> synchronizedList(List<E> list) {
+ public static <E> List<E> synchronizedList(final List<E> list) {
return SynchronizedList.synchronizedList(list);
}
@@ -388,7 +388,7 @@ public class ListUtils {
* @return an unmodifiable list backed by the given list
* @throws IllegalArgumentException if the list is null
*/
- public static <E> List<E> unmodifiableList(List<E> list) {
+ public static <E> List<E> unmodifiableList(final List<E> list) {
return UnmodifiableList.unmodifiableList(list);
}
@@ -406,7 +406,7 @@ public class ListUtils {
* @return a predicated list backed by the given list
* @throws IllegalArgumentException if the List or Predicate is null
*/
- public static <E> List<E> predicatedList(List<E> list, Predicate<E> predicate) {
+ public static <E> List<E> predicatedList(final List<E> list, final Predicate<E> predicate) {
return PredicatedList.predicatedList(list, predicate);
}
@@ -430,7 +430,7 @@ public class ListUtils {
* @return a transformed list backed by the given list
* @throws IllegalArgumentException if the List or Transformer is null
*/
- public static <E> List<E> transformedList(List<E> list, Transformer<? super E, ? extends E> transformer) {
+ public static <E> List<E> transformedList(final List<E> list, final Transformer<? super E, ? extends E> transformer) {
return TransformedList.transformingList(list, transformer);
}
@@ -464,7 +464,7 @@ public class ListUtils {
* @return a lazy list backed by the given list
* @throws IllegalArgumentException if the List or Factory is null
*/
- public static <E> List<E> lazyList(List<E> list, Factory<? extends E> factory) {
+ public static <E> List<E> lazyList(final List<E> list, final Factory<? extends E> factory) {
return LazyList.lazyList(list, factory);
}
@@ -479,7 +479,7 @@ public class ListUtils {
* @return a fixed-size list backed by that list
* @throws IllegalArgumentException if the List is null
*/
- public static <E> List<E> fixedSizeList(List<E> list) {
+ public static <E> List<E> fixedSizeList(final List<E> list) {
return FixedSizeList.fixedSizeList(list);
}
@@ -494,10 +494,10 @@ public class ListUtils {
* @param predicate the predicate to use, may be null
* @return the first index of an Object in the List which matches the predicate or -1 if none could be found
*/
- public static <E> int indexOf(List<E> list, Predicate<E> predicate) {
+ public static <E> int indexOf(final List<E> list, final Predicate<E> predicate) {
if (list != null && predicate != null) {
for (int i = 0; i < list.size(); i++) {
- E item = list.get(i);
+ final E item = list.get(i);
if (predicate.evaluate(item)) {
return i;
}
@@ -526,7 +526,7 @@ public class ListUtils {
* @return a list of consecutive sublists
* @throws IllegalArgumentException if list is {@code null} or size is not strictly positive
*/
- public static <T> List<List<T>> partition(List<T> list, int size) {
+ public static <T> List<List<T>> partition(final List<T> list, final int size) {
if (list == null) {
throw new IllegalArgumentException("List must not be null");
}
@@ -543,14 +543,14 @@ public class ListUtils {
private final List<T> list;
private final int size;
- private Partition(List<T> list, int size) {
+ private Partition(final List<T> list, final int size) {
this.list = list;
this.size = size;
}
@Override
- public List<T> get(int index) {
- int listSize = size();
+ public List<T> get(final int index) {
+ final int listSize = size();
if (listSize < 0) {
throw new IllegalArgumentException("negative size: " + listSize);
}
@@ -561,8 +561,8 @@ public class ListUtils {
throw new IndexOutOfBoundsException("Index " + index + " must be less than size " +
listSize);
}
- int start = index * size;
- int end = Math.min(start + size, list.size());
+ final int start = index * size;
+ final int end = Math.min(start + size, list.size());
return list.subList(start, end);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/MapUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/MapUtils.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/MapUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/MapUtils.java Mon Jan 7 17:15:14 2013
@@ -127,7 +127,7 @@ public class MapUtils {
*/
public static <K> String getString(final Map<? super K, ?> map, final K key) {
if (map != null) {
- Object answer = map.get(key);
+ final Object answer = map.get(key);
if (answer != null) {
return answer.toString();
}
@@ -151,7 +151,7 @@ public class MapUtils {
*/
public static <K> Boolean getBoolean(final Map<? super K, ?> map, final K key) {
if (map != null) {
- Object answer = map.get(key);
+ final Object answer = map.get(key);
if (answer != null) {
if (answer instanceof Boolean) {
return (Boolean) answer;
@@ -160,7 +160,7 @@ public class MapUtils {
return Boolean.valueOf((String) answer);
}
if (answer instanceof Number) {
- Number n = (Number) answer;
+ final Number n = (Number) answer;
return n.intValue() != 0 ? Boolean.TRUE : Boolean.FALSE;
}
}
@@ -183,16 +183,16 @@ public class MapUtils {
*/
public static <K> Number getNumber(final Map<? super K, ?> map, final K key) {
if (map != null) {
- Object answer = map.get(key);
+ final Object answer = map.get(key);
if (answer != null) {
if (answer instanceof Number) {
return (Number) answer;
}
if (answer instanceof String) {
try {
- String text = (String) answer;
+ final String text = (String) answer;
return NumberFormat.getInstance().parse(text);
- } catch (ParseException e) {
+ } catch (final ParseException e) {
// failure means null is returned
}
}
@@ -211,7 +211,7 @@ public class MapUtils {
* @return the value in the Map as a Byte, <code>null</code> if null map input
*/
public static <K> Byte getByte(final Map<? super K, ?> map, final K key) {
- Number answer = getNumber(map, key);
+ final Number answer = getNumber(map, key);
if (answer == null) {
return null;
}
@@ -231,7 +231,7 @@ public class MapUtils {
* @return the value in the Map as a Short, <code>null</code> if null map input
*/
public static <K> Short getShort(final Map<? super K, ?> map, final K key) {
- Number answer = getNumber(map, key);
+ final Number answer = getNumber(map, key);
if (answer == null) {
return null;
}
@@ -251,7 +251,7 @@ public class MapUtils {
* @return the value in the Map as a Integer, <code>null</code> if null map input
*/
public static <K> Integer getInteger(final Map<? super K, ?> map, final K key) {
- Number answer = getNumber(map, key);
+ final Number answer = getNumber(map, key);
if (answer == null) {
return null;
}
@@ -271,7 +271,7 @@ public class MapUtils {
* @return the value in the Map as a Long, <code>null</code> if null map input
*/
public static <K> Long getLong(final Map<? super K, ?> map, final K key) {
- Number answer = getNumber(map, key);
+ final Number answer = getNumber(map, key);
if (answer == null) {
return null;
}
@@ -291,7 +291,7 @@ public class MapUtils {
* @return the value in the Map as a Float, <code>null</code> if null map input
*/
public static <K> Float getFloat(final Map<? super K, ?> map, final K key) {
- Number answer = getNumber(map, key);
+ final Number answer = getNumber(map, key);
if (answer == null) {
return null;
}
@@ -311,7 +311,7 @@ public class MapUtils {
* @return the value in the Map as a Double, <code>null</code> if null map input
*/
public static <K> Double getDouble(final Map<? super K, ?> map, final K key) {
- Number answer = getNumber(map, key);
+ final Number answer = getNumber(map, key);
if (answer == null) {
return null;
}
@@ -333,7 +333,7 @@ public class MapUtils {
*/
public static <K> Map<?, ?> getMap(final Map<? super K, ?> map, final K key) {
if (map != null) {
- Object answer = map.get(key);
+ final Object answer = map.get(key);
if (answer != null && answer instanceof Map) {
return (Map<?, ?>) answer;
}
@@ -353,9 +353,9 @@ public class MapUtils {
* @return the value in the map, or defaultValue if the original value
* is null or the map is null
*/
- public static <K, V> V getObject(Map<K, V> map, K key, V defaultValue) {
+ public static <K, V> V getObject(final Map<K, V> map, final K key, final V defaultValue) {
if (map != null) {
- V answer = map.get(key);
+ final V answer = map.get(key);
if (answer != null) {
return answer;
}
@@ -375,7 +375,7 @@ public class MapUtils {
* original value is null, the map is null or the string conversion
* fails
*/
- public static <K> String getString(Map<? super K, ?> map, K key, String defaultValue) {
+ public static <K> String getString(final Map<? super K, ?> map, final K key, final String defaultValue) {
String answer = getString(map, key);
if (answer == null) {
answer = defaultValue;
@@ -395,7 +395,7 @@ public class MapUtils {
* original value is null, the map is null or the boolean conversion
* fails
*/
- public static <K> Boolean getBoolean(Map<? super K, ?> map, K key, Boolean defaultValue) {
+ public static <K> Boolean getBoolean(final Map<? super K, ?> map, final K key, final Boolean defaultValue) {
Boolean answer = getBoolean(map, key);
if (answer == null) {
answer = defaultValue;
@@ -415,7 +415,7 @@ public class MapUtils {
* original value is null, the map is null or the number conversion
* fails
*/
- public static <K> Number getNumber(Map<? super K, ?> map, K key, Number defaultValue) {
+ public static <K> Number getNumber(final Map<? super K, ?> map, final K key, final Number defaultValue) {
Number answer = getNumber(map, key);
if (answer == null) {
answer = defaultValue;
@@ -435,7 +435,7 @@ public class MapUtils {
* original value is null, the map is null or the number conversion
* fails
*/
- public static <K> Byte getByte(Map<? super K, ?> map, K key, Byte defaultValue) {
+ public static <K> Byte getByte(final Map<? super K, ?> map, final K key, final Byte defaultValue) {
Byte answer = getByte(map, key);
if (answer == null) {
answer = defaultValue;
@@ -455,7 +455,7 @@ public class MapUtils {
* original value is null, the map is null or the number conversion
* fails
*/
- public static <K> Short getShort(Map<? super K, ?> map, K key, Short defaultValue) {
+ public static <K> Short getShort(final Map<? super K, ?> map, final K key, final Short defaultValue) {
Short answer = getShort(map, key);
if (answer == null) {
answer = defaultValue;
@@ -475,7 +475,7 @@ public class MapUtils {
* original value is null, the map is null or the number conversion
* fails
*/
- public static <K> Integer getInteger(Map<? super K, ?> map, K key, Integer defaultValue) {
+ public static <K> Integer getInteger(final Map<? super K, ?> map, final K key, final Integer defaultValue) {
Integer answer = getInteger(map, key);
if (answer == null) {
answer = defaultValue;
@@ -495,7 +495,7 @@ public class MapUtils {
* original value is null, the map is null or the number conversion
* fails
*/
- public static <K> Long getLong(Map<? super K, ?> map, K key, Long defaultValue) {
+ public static <K> Long getLong(final Map<? super K, ?> map, final K key, final Long defaultValue) {
Long answer = getLong(map, key);
if (answer == null) {
answer = defaultValue;
@@ -515,7 +515,7 @@ public class MapUtils {
* original value is null, the map is null or the number conversion
* fails
*/
- public static <K> Float getFloat(Map<? super K, ?> map, K key, Float defaultValue) {
+ public static <K> Float getFloat(final Map<? super K, ?> map, final K key, final Float defaultValue) {
Float answer = getFloat(map, key);
if (answer == null) {
answer = defaultValue;
@@ -535,7 +535,7 @@ public class MapUtils {
* original value is null, the map is null or the number conversion
* fails
*/
- public static <K> Double getDouble(Map<? super K, ?> map, K key, Double defaultValue) {
+ public static <K> Double getDouble(final Map<? super K, ?> map, final K key, final Double defaultValue) {
Double answer = getDouble(map, key);
if (answer == null) {
answer = defaultValue;
@@ -555,7 +555,7 @@ public class MapUtils {
* original value is null, the map is null or the map conversion
* fails
*/
- public static <K> Map<?, ?> getMap(Map<? super K, ?> map, K key, Map<?, ?> defaultValue) {
+ public static <K> Map<?, ?> getMap(final Map<? super K, ?> map, final K key, final Map<?, ?> defaultValue) {
Map<?, ?> answer = getMap(map, key);
if (answer == null) {
answer = defaultValue;
@@ -593,7 +593,7 @@ public class MapUtils {
* @return the value in the Map as a byte, <code>0</code> if null map input
*/
public static <K> byte getByteValue(final Map<? super K, ?> map, final K key) {
- Byte byteObject = getByte(map, key);
+ final Byte byteObject = getByte(map, key);
if (byteObject == null) {
return 0;
}
@@ -610,7 +610,7 @@ public class MapUtils {
* @return the value in the Map as a short, <code>0</code> if null map input
*/
public static <K> short getShortValue(final Map<? super K, ?> map, final K key) {
- Short shortObject = getShort(map, key);
+ final Short shortObject = getShort(map, key);
if (shortObject == null) {
return 0;
}
@@ -627,7 +627,7 @@ public class MapUtils {
* @return the value in the Map as an int, <code>0</code> if null map input
*/
public static <K> int getIntValue(final Map<? super K, ?> map, final K key) {
- Integer integerObject = getInteger(map, key);
+ final Integer integerObject = getInteger(map, key);
if (integerObject == null) {
return 0;
}
@@ -644,7 +644,7 @@ public class MapUtils {
* @return the value in the Map as a long, <code>0L</code> if null map input
*/
public static <K> long getLongValue(final Map<? super K, ?> map, final K key) {
- Long longObject = getLong(map, key);
+ final Long longObject = getLong(map, key);
if (longObject == null) {
return 0L;
}
@@ -661,7 +661,7 @@ public class MapUtils {
* @return the value in the Map as a float, <code>0.0F</code> if null map input
*/
public static <K> float getFloatValue(final Map<? super K, ?> map, final K key) {
- Float floatObject = getFloat(map, key);
+ final Float floatObject = getFloat(map, key);
if (floatObject == null) {
return 0f;
}
@@ -678,7 +678,7 @@ public class MapUtils {
* @return the value in the Map as a double, <code>0.0</code> if null map input
*/
public static <K> double getDoubleValue(final Map<? super K, ?> map, final K key) {
- Double doubleObject = getDouble(map, key);
+ final Double doubleObject = getDouble(map, key);
if (doubleObject == null) {
return 0d;
}
@@ -704,8 +704,8 @@ public class MapUtils {
* conversion fails
* @return the value in the Map as a Boolean, <code>defaultValue</code> if null map input
*/
- public static <K> boolean getBooleanValue(final Map<? super K, ?> map, final K key, boolean defaultValue) {
- Boolean booleanObject = getBoolean(map, key);
+ public static <K> boolean getBooleanValue(final Map<? super K, ?> map, final K key, final boolean defaultValue) {
+ final Boolean booleanObject = getBoolean(map, key);
if (booleanObject == null) {
return defaultValue;
}
@@ -724,8 +724,8 @@ public class MapUtils {
* conversion fails
* @return the value in the Map as a byte, <code>defaultValue</code> if null map input
*/
- public static <K> byte getByteValue(final Map<? super K, ?> map, final K key, byte defaultValue) {
- Byte byteObject = getByte(map, key);
+ public static <K> byte getByteValue(final Map<? super K, ?> map, final K key, final byte defaultValue) {
+ final Byte byteObject = getByte(map, key);
if (byteObject == null) {
return defaultValue;
}
@@ -744,8 +744,8 @@ public class MapUtils {
* conversion fails
* @return the value in the Map as a short, <code>defaultValue</code> if null map input
*/
- public static <K> short getShortValue(final Map<? super K, ?> map, final K key, short defaultValue) {
- Short shortObject = getShort(map, key);
+ public static <K> short getShortValue(final Map<? super K, ?> map, final K key, final short defaultValue) {
+ final Short shortObject = getShort(map, key);
if (shortObject == null) {
return defaultValue;
}
@@ -764,8 +764,8 @@ public class MapUtils {
* conversion fails
* @return the value in the Map as an int, <code>defaultValue</code> if null map input
*/
- public static <K> int getIntValue(final Map<? super K, ?> map, final K key, int defaultValue) {
- Integer integerObject = getInteger(map, key);
+ public static <K> int getIntValue(final Map<? super K, ?> map, final K key, final int defaultValue) {
+ final Integer integerObject = getInteger(map, key);
if (integerObject == null) {
return defaultValue;
}
@@ -784,8 +784,8 @@ public class MapUtils {
* conversion fails
* @return the value in the Map as a long, <code>defaultValue</code> if null map input
*/
- public static <K> long getLongValue(final Map<? super K, ?> map, final K key, long defaultValue) {
- Long longObject = getLong(map, key);
+ public static <K> long getLongValue(final Map<? super K, ?> map, final K key, final long defaultValue) {
+ final Long longObject = getLong(map, key);
if (longObject == null) {
return defaultValue;
}
@@ -804,8 +804,8 @@ public class MapUtils {
* conversion fails
* @return the value in the Map as a float, <code>defaultValue</code> if null map input
*/
- public static <K> float getFloatValue(final Map<? super K, ?> map, final K key, float defaultValue) {
- Float floatObject = getFloat(map, key);
+ public static <K> float getFloatValue(final Map<? super K, ?> map, final K key, final float defaultValue) {
+ final Float floatObject = getFloat(map, key);
if (floatObject == null) {
return defaultValue;
}
@@ -824,8 +824,8 @@ public class MapUtils {
* conversion fails
* @return the value in the Map as a double, <code>defaultValue</code> if null map input
*/
- public static <K> double getDoubleValue(final Map<? super K, ?> map, final K key, double defaultValue) {
- Double doubleObject = getDouble(map, key);
+ public static <K> double getDoubleValue(final Map<? super K, ?> map, final K key, final double defaultValue) {
+ final Double doubleObject = getDouble(map, key);
if (doubleObject == null) {
return defaultValue;
}
@@ -842,12 +842,12 @@ public class MapUtils {
* @return the properties object
*/
public static <K, V> Properties toProperties(final Map<K, V> map) {
- Properties answer = new Properties();
+ final Properties answer = new Properties();
if (map != null) {
- for (Entry<K, V> entry2 : map.entrySet()) {
- Map.Entry<?, ?> entry = entry2;
- Object key = entry.getKey();
- Object value = entry.getValue();
+ for (final Entry<K, V> entry2 : map.entrySet()) {
+ final Map.Entry<?, ?> entry = entry2;
+ final Object key = entry.getKey();
+ final Object value = entry.getValue();
answer.put(key, value);
}
}
@@ -862,12 +862,12 @@ public class MapUtils {
* @throws NullPointerException if the bundle is null
*/
public static Map<String, Object> toMap(final ResourceBundle resourceBundle) {
- Enumeration<String> enumeration = resourceBundle.getKeys();
- Map<String, Object> map = new HashMap<String, Object>();
+ final Enumeration<String> enumeration = resourceBundle.getKeys();
+ final Map<String, Object> map = new HashMap<String, Object>();
while (enumeration.hasMoreElements()) {
- String key = enumeration.nextElement();
- Object value = resourceBundle.getObject(key);
+ final String key = enumeration.nextElement();
+ final Object value = resourceBundle.getObject(key);
map.put(key, value);
}
@@ -980,9 +980,9 @@ public class MapUtils {
lineage.push(map);
- for (Map.Entry<?, ?> entry : map.entrySet()) {
- Object childKey = entry.getKey();
- Object childValue = entry.getValue();
+ for (final Map.Entry<?, ?> entry : map.entrySet()) {
+ final Object childKey = entry.getKey();
+ final Object childValue = entry.getValue();
if (childValue instanceof Map && !lineage.contains(childValue)) {
verbosePrintInternal(
out,
@@ -1048,9 +1048,9 @@ public class MapUtils {
* @return a new HashMap containing the inverted data
* @throws NullPointerException if the map is null
*/
- public static <K, V> Map<V, K> invertMap(Map<K, V> map) {
- Map<V, K> out = new HashMap<V, K>(map.size());
- for (Entry<K, V> entry : map.entrySet()) {
+ public static <K, V> Map<V, K> invertMap(final Map<K, V> map) {
+ final Map<V, K> out = new HashMap<V, K>(map.size());
+ for (final Entry<K, V> entry : map.entrySet()) {
out.put(entry.getValue(), entry.getKey());
}
return out;
@@ -1076,7 +1076,7 @@ public class MapUtils {
* @param value the value, null converted to ""
* @throws NullPointerException if the map is null
*/
- public static <K> void safeAddToMap(Map<? super K, Object> map, K key, Object value) throws NullPointerException {
+ public static <K> void safeAddToMap(final Map<? super K, Object> map, final K key, final Object value) throws NullPointerException {
map.put(key, value == null ? "" : value);
}
@@ -1129,25 +1129,25 @@ public class MapUtils {
* @since 3.2
*/
@SuppressWarnings("unchecked")
- public static <K, V> Map<K, V> putAll(Map<K, V> map, Object[] array) {
+ public static <K, V> Map<K, V> putAll(final Map<K, V> map, final Object[] array) {
map.size(); // force NPE
if (array == null || array.length == 0) {
return map;
}
- Object obj = array[0];
+ final Object obj = array[0];
if (obj instanceof Map.Entry) {
- for (Object element : array) {
- Map.Entry<K, V> entry = (Map.Entry<K, V>) element;
+ for (final Object element : array) {
+ final Map.Entry<K, V> entry = (Map.Entry<K, V>) element;
map.put(entry.getKey(), entry.getValue());
}
} else if (obj instanceof KeyValue) {
- for (Object element : array) {
- KeyValue<K, V> keyval = (KeyValue<K, V>) element;
+ for (final Object element : array) {
+ final KeyValue<K, V> keyval = (KeyValue<K, V>) element;
map.put(keyval.getKey(), keyval.getValue());
}
} else if (obj instanceof Object[]) {
for (int i = 0; i < array.length; i++) {
- Object[] sub = (Object[]) array[i];
+ final Object[] sub = (Object[]) array[i];
if (sub == null || sub.length < 2) {
throw new IllegalArgumentException("Invalid array element: " + i);
}
@@ -1172,7 +1172,7 @@ public class MapUtils {
* @param map the map, possibly <code>null</code>
* @return an empty map if the argument is <code>null</code>
*/
- public static <K,V> Map<K,V> emptyIfNull(Map<K,V> map) {
+ public static <K,V> Map<K,V> emptyIfNull(final Map<K,V> map) {
return map == null ? Collections.<K,V>emptyMap() : map;
}
@@ -1185,7 +1185,7 @@ public class MapUtils {
* @return true if empty or null
* @since 3.2
*/
- public static boolean isEmpty(Map<?,?> map) {
+ public static boolean isEmpty(final Map<?,?> map) {
return map == null || map.isEmpty();
}
@@ -1198,7 +1198,7 @@ public class MapUtils {
* @return true if non-null and non-empty
* @since 3.2
*/
- public static boolean isNotEmpty(Map<?,?> map) {
+ public static boolean isNotEmpty(final Map<?,?> map) {
return !MapUtils.isEmpty(map);
}
@@ -1226,7 +1226,7 @@ public class MapUtils {
* @param map the map to synchronize, must not be null
* @return a synchronized map backed by the given map
*/
- public static <K, V> Map<K, V> synchronizedMap(Map<K, V> map) {
+ public static <K, V> Map<K, V> synchronizedMap(final Map<K, V> map) {
return Collections.synchronizedMap(map);
}
@@ -1239,7 +1239,7 @@ public class MapUtils {
* @return an unmodifiable map backed by the given map
* @throws IllegalArgumentException if the map is null
*/
- public static <K, V> Map<K, V> unmodifiableMap(Map<K, V> map) {
+ public static <K, V> Map<K, V> unmodifiableMap(final Map<K, V> map) {
return UnmodifiableMap.unmodifiableMap(map);
}
@@ -1258,7 +1258,7 @@ public class MapUtils {
* @return a predicated map backed by the given map
* @throws IllegalArgumentException if the Map is null
*/
- public static <K, V> IterableMap<K, V> predicatedMap(Map<K, V> map, Predicate<? super K> keyPred, Predicate<? super V> valuePred) {
+ public static <K, V> IterableMap<K, V> predicatedMap(final Map<K, V> map, final Predicate<? super K> keyPred, final Predicate<? super V> valuePred) {
return PredicatedMap.predicatedMap(map, keyPred, valuePred);
}
@@ -1283,9 +1283,9 @@ public class MapUtils {
* @return a transformed map backed by the given map
* @throws IllegalArgumentException if the Map is null
*/
- public static <K, V> IterableMap<K, V> transformedMap(Map<K, V> map,
- Transformer<? super K, ? extends K> keyTransformer,
- Transformer<? super V, ? extends V> valueTransformer) {
+ public static <K, V> IterableMap<K, V> transformedMap(final Map<K, V> map,
+ final Transformer<? super K, ? extends K> keyTransformer,
+ final Transformer<? super V, ? extends V> valueTransformer) {
return TransformedMap.transformingMap(map, keyTransformer, valueTransformer);
}
@@ -1299,7 +1299,7 @@ public class MapUtils {
* @return a fixed-size map backed by that map
* @throws IllegalArgumentException if the Map is null
*/
- public static <K, V> IterableMap<K, V> fixedSizeMap(Map<K, V> map) {
+ public static <K, V> IterableMap<K, V> fixedSizeMap(final Map<K, V> map) {
return FixedSizeMap.fixedSizeMap(map);
}
@@ -1331,7 +1331,7 @@ public class MapUtils {
* @return a lazy map backed by the given map
* @throws IllegalArgumentException if the Map or Factory is null
*/
- public static <K, V> IterableMap<K, V> lazyMap(Map<K, V> map, Factory<? extends V> factory) {
+ public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) {
return LazyMap.lazyMap(map, factory);
}
@@ -1370,7 +1370,7 @@ public class MapUtils {
* @return a lazy map backed by the given map
* @throws IllegalArgumentException if the Map or Transformer is null
*/
- public static <K, V> IterableMap<K, V> lazyMap(Map<K, V> map, Transformer<? super K, ? extends V> transformerFactory) {
+ public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Transformer<? super K, ? extends V> transformerFactory) {
return LazyMap.lazyMap(map, transformerFactory);
}
@@ -1385,7 +1385,7 @@ public class MapUtils {
* @return an ordered map backed by the given map
* @throws IllegalArgumentException if the Map is null
*/
- public static <K, V> OrderedMap<K, V> orderedMap(Map<K, V> map) {
+ public static <K, V> OrderedMap<K, V> orderedMap(final Map<K, V> map) {
return ListOrderedMap.listOrderedMap(map);
}
@@ -1398,7 +1398,7 @@ public class MapUtils {
* @see MultiValueMap
* @since 3.2
*/
- public static <K, V> MultiValueMap<K, V> multiValueMap(Map<K, ? super Collection<V>> map) {
+ public static <K, V> MultiValueMap<K, V> multiValueMap(final Map<K, ? super Collection<V>> map) {
return MultiValueMap.<K, V>multiValueMap(map);
}
@@ -1413,7 +1413,7 @@ public class MapUtils {
* @see MultiValueMap
* @since 3.2
*/
- public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, C> map, Class<C> collectionClass) {
+ public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(final Map<K, C> map, final Class<C> collectionClass) {
return MultiValueMap.multiValueMap(map, collectionClass);
}
@@ -1428,7 +1428,7 @@ public class MapUtils {
* @see MultiValueMap
* @since 3.2
*/
- public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, C> map, Factory<C> collectionFactory) {
+ public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(final Map<K, C> map, final Factory<C> collectionFactory) {
return MultiValueMap.multiValueMap(map, collectionFactory);
}
@@ -1457,7 +1457,7 @@ public class MapUtils {
* @return a synchronized map backed by the given map
* @throws IllegalArgumentException if the map is null
*/
- public static <K, V> SortedMap<K, V> synchronizedSortedMap(SortedMap<K, V> map) {
+ public static <K, V> SortedMap<K, V> synchronizedSortedMap(final SortedMap<K, V> map) {
return Collections.synchronizedSortedMap(map);
}
@@ -1470,7 +1470,7 @@ public class MapUtils {
* @return an unmodifiable map backed by the given map
* @throws IllegalArgumentException if the map is null
*/
- public static <K, V> SortedMap<K, V> unmodifiableSortedMap(SortedMap<K, V> map) {
+ public static <K, V> SortedMap<K, V> unmodifiableSortedMap(final SortedMap<K, V> map) {
return UnmodifiableSortedMap.unmodifiableSortedMap(map);
}
@@ -1489,8 +1489,8 @@ public class MapUtils {
* @return a predicated map backed by the given map
* @throws IllegalArgumentException if the SortedMap is null
*/
- public static <K, V> SortedMap<K, V> predicatedSortedMap(SortedMap<K, V> map,
- Predicate<? super K> keyPred, Predicate<? super V> valuePred) {
+ public static <K, V> SortedMap<K, V> predicatedSortedMap(final SortedMap<K, V> map,
+ final Predicate<? super K> keyPred, final Predicate<? super V> valuePred) {
return PredicatedSortedMap.predicatedSortedMap(map, keyPred, valuePred);
}
@@ -1515,9 +1515,9 @@ public class MapUtils {
* @return a transformed map backed by the given map
* @throws IllegalArgumentException if the SortedMap is null
*/
- public static <K, V> SortedMap<K, V> transformedSortedMap(SortedMap<K, V> map,
- Transformer<? super K, ? extends K> keyTransformer,
- Transformer<? super V, ? extends V> valueTransformer) {
+ public static <K, V> SortedMap<K, V> transformedSortedMap(final SortedMap<K, V> map,
+ final Transformer<? super K, ? extends K> keyTransformer,
+ final Transformer<? super V, ? extends V> valueTransformer) {
return TransformedSortedMap.transformingSortedMap(map, keyTransformer, valueTransformer);
}
@@ -1531,7 +1531,7 @@ public class MapUtils {
* @return a fixed-size map backed by that map
* @throws IllegalArgumentException if the SortedMap is null
*/
- public static <K, V> SortedMap<K, V> fixedSizeSortedMap(SortedMap<K, V> map) {
+ public static <K, V> SortedMap<K, V> fixedSizeSortedMap(final SortedMap<K, V> map) {
return FixedSizeSortedMap.fixedSizeSortedMap(map);
}
@@ -1564,8 +1564,8 @@ public class MapUtils {
* @return a lazy map backed by the given map
* @throws IllegalArgumentException if the SortedMap or Factory is null
*/
- public static <K, V> SortedMap<K, V> lazySortedMap(SortedMap<K, V> map,
- Factory<? extends V> factory) {
+ public static <K, V> SortedMap<K, V> lazySortedMap(final SortedMap<K, V> map,
+ final Factory<? extends V> factory) {
return LazySortedMap.lazySortedMap(map, factory);
}
@@ -1604,8 +1604,8 @@ public class MapUtils {
* @return a lazy map backed by the given map
* @throws IllegalArgumentException if the Map or Transformer is null
*/
- public static <K, V> SortedMap<K, V> lazySortedMap(SortedMap<K, V> map,
- Transformer<? super K, ? extends V> transformerFactory) {
+ public static <K, V> SortedMap<K, V> lazySortedMap(final SortedMap<K, V> map,
+ final Transformer<? super K, ? extends V> transformerFactory) {
return LazySortedMap.lazySortedMap(map, transformerFactory);
}
@@ -1619,7 +1619,7 @@ public class MapUtils {
* @param keyTransformer the <code>Transformer</code> used to transform the collection value into a key value
* @throws NullPointerException if the map, collection or transformer are null
*/
- public static <K, V> void populateMap(Map<K, V> map, Collection<? extends V> collection, Transformer<V, K> keyTransformer) {
+ public static <K, V> void populateMap(final Map<K, V> map, final Collection<? extends V> collection, final Transformer<V, K> keyTransformer) {
populateMap(map, collection, keyTransformer, TransformerUtils.<V>nopTransformer());
}
@@ -1634,12 +1634,12 @@ public class MapUtils {
* @param valueTransformer the <code>Transformer</code> used to transform the collection value into a value
* @throws NullPointerException if the map, collection or transformers are null
*/
- public static <K, V, E> void populateMap(Map<K, V> map, Collection<? extends E> collection,
- Transformer<E, K> keyTransformer,
- Transformer<E, V> valueTransformer) {
- Iterator<? extends E> iter = collection.iterator();
+ public static <K, V, E> void populateMap(final Map<K, V> map, final Collection<? extends E> collection,
+ final Transformer<E, K> keyTransformer,
+ final Transformer<E, V> valueTransformer) {
+ final Iterator<? extends E> iter = collection.iterator();
while (iter.hasNext()) {
- E temp = iter.next();
+ final E temp = iter.next();
map.put(keyTransformer.transform(temp), valueTransformer.transform(temp));
}
}
@@ -1652,7 +1652,7 @@ public class MapUtils {
* @return IterableMap<K, V>
* @since 4.0
*/
- public static <K, V> IterableMap<K, V> iterableMap(Map<K, V> map) {
+ public static <K, V> IterableMap<K, V> iterableMap(final Map<K, V> map) {
if (map == null) {
throw new IllegalArgumentException("Map must not be null");
}
@@ -1669,7 +1669,7 @@ public class MapUtils {
* @return {@link IterableSortedMap}<K, V>
* @since 4.0
*/
- public static <K, V> IterableSortedMap<K, V> iterableSortedMap(SortedMap<K, V> sortedMap) {
+ public static <K, V> IterableSortedMap<K, V> iterableSortedMap(final SortedMap<K, V> sortedMap) {
if (sortedMap == null) {
throw new IllegalArgumentException("Map must not be null");
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/PredicateUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/PredicateUtils.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/PredicateUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/PredicateUtils.java Mon Jan 7 17:15:14 2013
@@ -154,7 +154,7 @@ public class PredicateUtils {
* @deprecated use {@link EqualPredicate#equalPredicate(Object)} instead.
*/
@Deprecated
- public static <T> Predicate<T> equalPredicate(T value) {
+ public static <T> Predicate<T> equalPredicate(final T value) {
return EqualPredicate.equalPredicate(value);
}
@@ -167,7 +167,7 @@ public class PredicateUtils {
* @param value the value to compare against
* @return the predicate
*/
- public static <T> Predicate<T> identityPredicate(T value) {
+ public static <T> Predicate<T> identityPredicate(final T value) {
return IdentityPredicate.<T>identityPredicate(value);
}
@@ -182,7 +182,7 @@ public class PredicateUtils {
* @return the predicate
* @throws IllegalArgumentException if the class is null
*/
- public static Predicate<Object> instanceofPredicate(Class<?> type) {
+ public static Predicate<Object> instanceofPredicate(final Class<?> type) {
return InstanceofPredicate.instanceOfPredicate(type);
}
@@ -219,7 +219,7 @@ public class PredicateUtils {
* @return the predicate
* @throws IllegalArgumentException if the methodName is null.
*/
- public static <T> Predicate<T> invokerPredicate(String methodName){
+ public static <T> Predicate<T> invokerPredicate(final String methodName){
// reuse transformer as it has caching - this is lazy really, should have inner class here
return asPredicate(InvokerTransformer.<Object, Boolean>invokerTransformer(methodName));
}
@@ -244,7 +244,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the method name is null
* @throws IllegalArgumentException if the paramTypes and args don't match
*/
- public static <T> Predicate<T> invokerPredicate(String methodName, Class<?>[] paramTypes, Object[] args){
+ public static <T> Predicate<T> invokerPredicate(final String methodName, final Class<?>[] paramTypes, final Object[] args){
// reuse transformer as it has caching - this is lazy really, should have inner class here
return asPredicate(InvokerTransformer.<Object, Boolean>invokerTransformer(methodName, paramTypes, args));
}
@@ -263,7 +263,7 @@ public class PredicateUtils {
* @return the <code>and</code> predicate
* @throws IllegalArgumentException if either predicate is null
*/
- public static <T> Predicate<T> andPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
+ public static <T> Predicate<T> andPredicate(final Predicate<? super T> predicate1, final Predicate<? super T> predicate2) {
return AndPredicate.<T>andPredicate(predicate1, predicate2);
}
@@ -281,7 +281,7 @@ public class PredicateUtils {
* @deprecated use {@link AllPredicate#allPredicate(Predicate...)} instead.
*/
@Deprecated
- public static <T> Predicate<T> allPredicate(Predicate<? super T>... predicates) {
+ public static <T> Predicate<T> allPredicate(final Predicate<? super T>... predicates) {
return AllPredicate.allPredicate(predicates);
}
@@ -297,7 +297,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates collection is null
* @throws IllegalArgumentException if any predicate in the collection is null
*/
- public static <T> Predicate<T> allPredicate(Collection<? extends Predicate<T>> predicates) {
+ public static <T> Predicate<T> allPredicate(final Collection<? extends Predicate<T>> predicates) {
return AllPredicate.allPredicate(predicates);
}
@@ -312,7 +312,7 @@ public class PredicateUtils {
* @return the <code>or</code> predicate
* @throws IllegalArgumentException if either predicate is null
*/
- public static <T> Predicate<T> orPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
+ public static <T> Predicate<T> orPredicate(final Predicate<? super T> predicate1, final Predicate<? super T> predicate2) {
return OrPredicate.<T>orPredicate(predicate1, predicate2);
}
@@ -328,7 +328,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates array is null
* @throws IllegalArgumentException if any predicate in the array is null
*/
- public static <T> Predicate<T> anyPredicate(Predicate<? super T>... predicates) {
+ public static <T> Predicate<T> anyPredicate(final Predicate<? super T>... predicates) {
return AnyPredicate.anyPredicate(predicates);
}
@@ -344,7 +344,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates collection is null
* @throws IllegalArgumentException if any predicate in the collection is null
*/
- public static <T> Predicate<T> anyPredicate(Collection<? extends Predicate<T>> predicates) {
+ public static <T> Predicate<T> anyPredicate(final Collection<? extends Predicate<T>> predicates) {
return AnyPredicate.anyPredicate(predicates);
}
@@ -359,8 +359,9 @@ public class PredicateUtils {
* @return the <code>either</code> predicate
* @throws IllegalArgumentException if either predicate is null
*/
- public static <T> Predicate<T> eitherPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
+ public static <T> Predicate<T> eitherPredicate(final Predicate<? super T> predicate1, final Predicate<? super T> predicate2) {
@SuppressWarnings("unchecked")
+ final
Predicate<T> onePredicate = PredicateUtils.<T>onePredicate(predicate1, predicate2);
return onePredicate;
}
@@ -377,7 +378,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates array is null
* @throws IllegalArgumentException if any predicate in the array is null
*/
- public static <T> Predicate<T> onePredicate(Predicate<? super T>... predicates) {
+ public static <T> Predicate<T> onePredicate(final Predicate<? super T>... predicates) {
return OnePredicate.onePredicate(predicates);
}
@@ -393,7 +394,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates collection is null
* @throws IllegalArgumentException if any predicate in the collection is null
*/
- public static <T> Predicate<T> onePredicate(Collection<Predicate<T>> predicates) {
+ public static <T> Predicate<T> onePredicate(final Collection<Predicate<T>> predicates) {
return OnePredicate.onePredicate(predicates);
}
@@ -408,8 +409,9 @@ public class PredicateUtils {
* @return the <code>neither</code> predicate
* @throws IllegalArgumentException if either predicate is null
*/
- public static <T> Predicate<T> neitherPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) {
+ public static <T> Predicate<T> neitherPredicate(final Predicate<? super T> predicate1, final Predicate<? super T> predicate2) {
@SuppressWarnings("unchecked")
+ final
Predicate<T> nonePredicate = PredicateUtils.<T>nonePredicate(predicate1, predicate2);
return nonePredicate;
}
@@ -426,7 +428,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates array is null
* @throws IllegalArgumentException if any predicate in the array is null
*/
- public static <T> Predicate<T> nonePredicate(Predicate<? super T>... predicates) {
+ public static <T> Predicate<T> nonePredicate(final Predicate<? super T>... predicates) {
return NonePredicate.nonePredicate(predicates);
}
@@ -442,7 +444,7 @@ public class PredicateUtils {
* @throws IllegalArgumentException if the predicates collection is null
* @throws IllegalArgumentException if any predicate in the collection is null
*/
- public static <T> Predicate<T> nonePredicate(Collection<? extends Predicate<T>> predicates) {
+ public static <T> Predicate<T> nonePredicate(final Collection<? extends Predicate<T>> predicates) {
return NonePredicate.nonePredicate(predicates);
}
@@ -456,7 +458,7 @@ public class PredicateUtils {
* @return the <code>not</code> predicate
* @throws IllegalArgumentException if the predicate is null
*/
- public static <T> Predicate<T> notPredicate(Predicate<? super T> predicate) {
+ public static <T> Predicate<T> notPredicate(final Predicate<? super T> predicate) {
return NotPredicate.notPredicate(predicate);
}
@@ -474,7 +476,7 @@ public class PredicateUtils {
* @return the transformer wrapping predicate
* @throws IllegalArgumentException if the transformer is null
*/
- public static <T> Predicate<T> asPredicate(Transformer<? super T, Boolean> transformer) {
+ public static <T> Predicate<T> asPredicate(final Transformer<? super T, Boolean> transformer) {
return TransformerPredicate.transformerPredicate(transformer);
}
@@ -492,7 +494,7 @@ public class PredicateUtils {
* @return the predicate
* @throws IllegalArgumentException if the predicate is null.
*/
- public static <T> Predicate<T> nullIsExceptionPredicate(Predicate<? super T> predicate){
+ public static <T> Predicate<T> nullIsExceptionPredicate(final Predicate<? super T> predicate){
return NullIsExceptionPredicate.nullIsExceptionPredicate(predicate);
}
@@ -507,7 +509,7 @@ public class PredicateUtils {
* @return the predicate
* @throws IllegalArgumentException if the predicate is null.
*/
- public static <T> Predicate<T> nullIsFalsePredicate(Predicate<? super T> predicate){
+ public static <T> Predicate<T> nullIsFalsePredicate(final Predicate<? super T> predicate){
return NullIsFalsePredicate.nullIsFalsePredicate(predicate);
}
@@ -522,7 +524,7 @@ public class PredicateUtils {
* @return the predicate
* @throws IllegalArgumentException if the predicate is null.
*/
- public static <T> Predicate<T> nullIsTruePredicate(Predicate<? super T> predicate){
+ public static <T> Predicate<T> nullIsTruePredicate(final Predicate<? super T> predicate){
return NullIsTruePredicate.nullIsTruePredicate(predicate);
}
@@ -541,7 +543,7 @@ public class PredicateUtils {
* @since 3.1
*/
public static <T> Predicate<T> transformedPredicate(
- Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) {
+ final Transformer<? super T, ? extends T> transformer, final Predicate<? super T> predicate) {
return TransformedPredicate.<T>transformedPredicate(transformer, predicate);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/SetUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/SetUtils.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/SetUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/SetUtils.java Mon Jan 7 17:15:14 2013
@@ -90,7 +90,7 @@ public class SetUtils {
* @param set the set, possibly <code>null</code>
* @return an empty set if the argument is <code>null</code>
*/
- public static <T> Set<T> emptyIfNull(Set<T> set) {
+ public static <T> Set<T> emptyIfNull(final Set<T> set) {
return set == null ? Collections.<T>emptySet() : set;
}
@@ -152,7 +152,7 @@ public class SetUtils {
}
int hashCode = 0;
- for (T obj : set) {
+ for (final T obj : set) {
if (obj != null) {
hashCode += obj.hashCode();
}
@@ -184,7 +184,7 @@ public class SetUtils {
* @return a synchronized set backed by the given set
* @throws IllegalArgumentException if the set is null
*/
- public static <E> Set<E> synchronizedSet(Set<E> set) {
+ public static <E> Set<E> synchronizedSet(final Set<E> set) {
return SynchronizedSet.synchronizedSet(set);
}
@@ -198,7 +198,7 @@ public class SetUtils {
* @return an unmodifiable set backed by the given set
* @throws IllegalArgumentException if the set is null
*/
- public static <E> Set<E> unmodifiableSet(Set<E> set) {
+ public static <E> Set<E> unmodifiableSet(final Set<E> set) {
return UnmodifiableSet.unmodifiableSet(set);
}
@@ -216,7 +216,7 @@ public class SetUtils {
* @return a predicated set backed by the given set
* @throws IllegalArgumentException if the Set or Predicate is null
*/
- public static <E> Set<E> predicatedSet(Set<E> set, Predicate<? super E> predicate) {
+ public static <E> Set<E> predicatedSet(final Set<E> set, final Predicate<? super E> predicate) {
return PredicatedSet.predicatedSet(set, predicate);
}
@@ -236,7 +236,7 @@ public class SetUtils {
* @return a transformed set backed by the given set
* @throws IllegalArgumentException if the Set or Transformer is null
*/
- public static <E> Set<E> transformedSet(Set<E> set, Transformer<? super E, ? extends E> transformer) {
+ public static <E> Set<E> transformedSet(final Set<E> set, final Transformer<? super E, ? extends E> transformer) {
return TransformedSet.transformingSet(set, transformer);
}
@@ -252,7 +252,7 @@ public class SetUtils {
* @return an ordered set backed by the given set
* @throws IllegalArgumentException if the Set is null
*/
- public static <E> Set<E> orderedSet(Set<E> set) {
+ public static <E> Set<E> orderedSet(final Set<E> set) {
return ListOrderedSet.listOrderedSet(set);
}
@@ -280,7 +280,7 @@ public class SetUtils {
* @return a synchronized set backed by the given set
* @throws IllegalArgumentException if the set is null
*/
- public static <E> SortedSet<E> synchronizedSortedSet(SortedSet<E> set) {
+ public static <E> SortedSet<E> synchronizedSortedSet(final SortedSet<E> set) {
return SynchronizedSortedSet.synchronizedSortedSet(set);
}
@@ -294,7 +294,7 @@ public class SetUtils {
* @return an unmodifiable set backed by the given set
* @throws IllegalArgumentException if the set is null
*/
- public static <E> SortedSet<E> unmodifiableSortedSet(SortedSet<E> set) {
+ public static <E> SortedSet<E> unmodifiableSortedSet(final SortedSet<E> set) {
return UnmodifiableSortedSet.unmodifiableSortedSet(set);
}
@@ -312,7 +312,7 @@ public class SetUtils {
* @return a predicated sorted set backed by the given sorted set
* @throws IllegalArgumentException if the Set or Predicate is null
*/
- public static <E> SortedSet<E> predicatedSortedSet(SortedSet<E> set, Predicate<? super E> predicate) {
+ public static <E> SortedSet<E> predicatedSortedSet(final SortedSet<E> set, final Predicate<? super E> predicate) {
return PredicatedSortedSet.predicatedSortedSet(set, predicate);
}
@@ -332,8 +332,8 @@ public class SetUtils {
* @return a transformed set backed by the given set
* @throws IllegalArgumentException if the Set or Transformer is null
*/
- public static <E> SortedSet<E> transformedSortedSet(SortedSet<E> set,
- Transformer<? super E, ? extends E> transformer) {
+ public static <E> SortedSet<E> transformedSortedSet(final SortedSet<E> set,
+ final Transformer<? super E, ? extends E> transformer) {
return TransformedSortedSet.transformingSortedSet(set, transformer);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/SplitMapUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/SplitMapUtils.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/SplitMapUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/SplitMapUtils.java Mon Jan 7 17:15:14 2013
@@ -47,7 +47,7 @@ public class SplitMapUtils {
private static class WrappedGet<K, V> implements IterableMap<K, V>, Unmodifiable {
private final Get<K, V> get;
- private WrappedGet(Get<K, V> get) {
+ private WrappedGet(final Get<K, V> get) {
this.get = get;
}
@@ -55,11 +55,11 @@ public class SplitMapUtils {
throw new UnsupportedOperationException();
}
- public boolean containsKey(Object key) {
+ public boolean containsKey(final Object key) {
return get.containsKey(key);
}
- public boolean containsValue(Object value) {
+ public boolean containsValue(final Object value) {
return get.containsValue(value);
}
@@ -68,14 +68,14 @@ public class SplitMapUtils {
}
@Override
- public boolean equals(Object arg0) {
+ public boolean equals(final Object arg0) {
if (arg0 == this) {
return true;
}
return arg0 instanceof WrappedGet && ((WrappedGet<?, ?>) arg0).get.equals(this.get);
}
- public V get(Object key) {
+ public V get(final Object key) {
return get.get(key);
}
@@ -92,15 +92,15 @@ public class SplitMapUtils {
return UnmodifiableSet.unmodifiableSet(get.keySet());
}
- public V put(K key, V value) {
+ public V put(final K key, final V value) {
throw new UnsupportedOperationException();
}
- public void putAll(Map<? extends K, ? extends V> t) {
+ public void putAll(final Map<? extends K, ? extends V> t) {
throw new UnsupportedOperationException();
}
- public V remove(Object key) {
+ public V remove(final Object key) {
return get.remove(key);
}
@@ -126,7 +126,7 @@ public class SplitMapUtils {
private static class WrappedPut<K, V> implements Map<K, V>, Put<K, V> {
private final Put<K, V> put;
- private WrappedPut(Put<K, V> put) {
+ private WrappedPut(final Put<K, V> put) {
this.put = put;
}
@@ -134,11 +134,11 @@ public class SplitMapUtils {
put.clear();
}
- public boolean containsKey(Object key) {
+ public boolean containsKey(final Object key) {
throw new UnsupportedOperationException();
}
- public boolean containsValue(Object value) {
+ public boolean containsValue(final Object value) {
throw new UnsupportedOperationException();
}
@@ -147,14 +147,14 @@ public class SplitMapUtils {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
return obj instanceof WrappedPut && ((WrappedPut<?, ?>) obj).put.equals(this.put);
}
- public V get(Object key) {
+ public V get(final Object key) {
throw new UnsupportedOperationException();
}
@@ -172,15 +172,15 @@ public class SplitMapUtils {
}
@SuppressWarnings("unchecked")
- public V put(K key, V value) {
+ public V put(final K key, final V value) {
return (V) put.put(key, value);
}
- public void putAll(Map<? extends K, ? extends V> t) {
+ public void putAll(final Map<? extends K, ? extends V> t) {
put.putAll(t);
}
- public V remove(Object key) {
+ public V remove(final Object key) {
throw new UnsupportedOperationException();
}
@@ -204,7 +204,7 @@ public class SplitMapUtils {
* @return {@link IterableMap}
*/
@SuppressWarnings("unchecked")
- public static <K, V> IterableMap<K, V> readableMap(Get<K, V> get) {
+ public static <K, V> IterableMap<K, V> readableMap(final Get<K, V> get) {
if (get == null) {
throw new IllegalArgumentException("Get must not be null");
}
@@ -228,7 +228,7 @@ public class SplitMapUtils {
* @return {@link Map}
*/
@SuppressWarnings("unchecked")
- public static <K, V> Map<K, V> writableMap(Put<K, V> put) {
+ public static <K, V> Map<K, V> writableMap(final Put<K, V> put) {
if (put == null) {
throw new IllegalArgumentException("Put must not be null");
}