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 [13/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/...
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/ListOrderedSet.java Mon Jan 7 17:15:14 2013
@@ -74,7 +74,7 @@ public class ListOrderedSet<E>
* @throws IllegalArgumentException if either the set or list is not empty
* @since 3.1
*/
- public static <E> ListOrderedSet<E> listOrderedSet(Set<E> set, List<E> list) {
+ public static <E> ListOrderedSet<E> listOrderedSet(final Set<E> set, final List<E> list) {
if (set == null) {
throw new IllegalArgumentException("Set must not be null");
}
@@ -97,7 +97,7 @@ public class ListOrderedSet<E>
* @return a new ordered set
* @throws IllegalArgumentException if set is null
*/
- public static <E> ListOrderedSet<E> listOrderedSet(Set<E> set) {
+ public static <E> ListOrderedSet<E> listOrderedSet(final Set<E> set) {
return new ListOrderedSet<E>(set);
}
@@ -115,11 +115,11 @@ public class ListOrderedSet<E>
* @return a new ordered set
* @throws IllegalArgumentException if list is null
*/
- public static <E> ListOrderedSet<E> listOrderedSet(List<E> list) {
+ public static <E> ListOrderedSet<E> listOrderedSet(final List<E> list) {
if (list == null) {
throw new IllegalArgumentException("List must not be null");
}
- Set<E> set = new HashSet<E>(list);
+ final Set<E> set = new HashSet<E>(list);
list.retainAll(set);
return new ListOrderedSet<E>(set, list);
@@ -143,7 +143,7 @@ public class ListOrderedSet<E>
* @param set the set to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
- protected ListOrderedSet(Set<E> set) {
+ protected ListOrderedSet(final Set<E> set) {
super(set);
setOrder = new ArrayList<E>(set);
}
@@ -158,7 +158,7 @@ public class ListOrderedSet<E>
* @param list the list to decorate, must not be null
* @throws IllegalArgumentException if set or list is null
*/
- protected ListOrderedSet(Set<E> set, List<E> list) {
+ protected ListOrderedSet(final Set<E> set, final List<E> list) {
super(set);
if (list == null) {
throw new IllegalArgumentException("List must not be null");
@@ -189,7 +189,7 @@ public class ListOrderedSet<E>
}
@Override
- public boolean add(E object) {
+ public boolean add(final E object) {
if (collection.add(object)) {
setOrder.add(object);
return true;
@@ -198,17 +198,17 @@ public class ListOrderedSet<E>
}
@Override
- public boolean addAll(Collection<? extends E> coll) {
+ public boolean addAll(final Collection<? extends E> coll) {
boolean result = false;
- for (E e : coll) {
+ for (final E e : coll) {
result |= add(e);
}
return result;
}
@Override
- public boolean remove(Object object) {
- boolean result = collection.remove(object);
+ public boolean remove(final Object object) {
+ final boolean result = collection.remove(object);
if (result) {
setOrder.remove(object);
}
@@ -216,18 +216,18 @@ public class ListOrderedSet<E>
}
@Override
- public boolean removeAll(Collection<?> coll) {
+ public boolean removeAll(final Collection<?> coll) {
boolean result = false;
- for (Object name : coll) {
+ for (final Object name : coll) {
result |= remove(name);
}
return result;
}
@Override
- public boolean retainAll(Collection<?> coll) {
- Set<Object> collectionRetainAll = new HashSet<Object>();
- for (Object next : coll) {
+ public boolean retainAll(final Collection<?> coll) {
+ final Set<Object> collectionRetainAll = new HashSet<Object>();
+ for (final Object next : coll) {
if (collection.contains(next)) {
collectionRetainAll.add(next);
}
@@ -238,7 +238,7 @@ public class ListOrderedSet<E>
if (collectionRetainAll.size() == 0) {
clear();
} else {
- for (Iterator<E> it = iterator(); it.hasNext();) {
+ for (final Iterator<E> it = iterator(); it.hasNext();) {
if (!collectionRetainAll.contains(it.next())) {
it.remove();
}
@@ -253,7 +253,7 @@ public class ListOrderedSet<E>
}
@Override
- public <T> T[] toArray(T a[]) {
+ public <T> T[] toArray(final T a[]) {
return setOrder.toArray(a);
}
@@ -268,7 +268,7 @@ public class ListOrderedSet<E>
* @return the element at position {@code index}
* @see List#get(int)
*/
- public E get(int index) {
+ public E get(final int index) {
return setOrder.get(index);
}
@@ -281,7 +281,7 @@ public class ListOrderedSet<E>
* this ordered set does not contain this object
* @see List#indexOf(Object)
*/
- public int indexOf(Object object) {
+ public int indexOf(final Object object) {
return setOrder.indexOf(object);
}
@@ -294,7 +294,7 @@ public class ListOrderedSet<E>
* @param object the element to be inserted
* @see List#add(int, Object)
*/
- public void add(int index, E object) {
+ public void add(final int index, final E object) {
if (!contains(object)) {
collection.add(object);
setOrder.add(index, object);
@@ -312,11 +312,11 @@ public class ListOrderedSet<E>
* @return {@code true} if this ordered set changed as a result of the call
* @see List#addAll(int, Collection)
*/
- public boolean addAll(int index, Collection<? extends E> coll) {
+ public boolean addAll(final int index, final Collection<? extends E> coll) {
boolean changed = false;
// collect all elements to be added for performance reasons
final List<E> toAdd = new ArrayList<E>();
- for (E e : coll) {
+ for (final E e : coll) {
if (contains(e)) {
continue;
}
@@ -340,8 +340,8 @@ public class ListOrderedSet<E>
* @return the element that has been remove from the ordered set
* @see List#remove(int)
*/
- public Object remove(int index) {
- Object obj = setOrder.remove(index);
+ public Object remove(final int index) {
+ final Object obj = setOrder.remove(index);
remove(obj);
return obj;
}
@@ -373,7 +373,7 @@ public class ListOrderedSet<E>
/** Last object retrieved */
protected E last;
- private OrderedSetIterator(ListIterator<E> iterator, Collection<E> set) {
+ private OrderedSetIterator(final ListIterator<E> iterator, final Collection<E> set) {
super(iterator);
this.set = set;
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/MapBackedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/MapBackedSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/MapBackedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/MapBackedSet.java Mon Jan 7 17:15:14 2013
@@ -55,7 +55,7 @@ public final class MapBackedSet<E, V> im
* @return a new map backed set
* @throws IllegalArgumentException if set is null
*/
- public static <E, V> MapBackedSet<E, V> mapBackedSet(Map<E, ? super V> map) {
+ public static <E, V> MapBackedSet<E, V> mapBackedSet(final Map<E, ? super V> map) {
return mapBackedSet(map, null);
}
@@ -69,7 +69,7 @@ public final class MapBackedSet<E, V> im
* @return a new map backed set
* @throws IllegalArgumentException if map is null
*/
- public static <E, V> MapBackedSet<E, V> mapBackedSet(Map<E, ? super V> map, V dummyValue) {
+ public static <E, V> MapBackedSet<E, V> mapBackedSet(final Map<E, ? super V> map, final V dummyValue) {
if (map == null) {
throw new IllegalArgumentException("The map must not be null");
}
@@ -84,7 +84,7 @@ public final class MapBackedSet<E, V> im
* @param dummyValue the dummy value to use
* @throws IllegalArgumentException if map is null
*/
- private MapBackedSet(Map<E, ? super V> map, V dummyValue) {
+ private MapBackedSet(final Map<E, ? super V> map, final V dummyValue) {
super();
this.map = map;
this.dummyValue = dummyValue;
@@ -103,39 +103,39 @@ public final class MapBackedSet<E, V> im
return map.keySet().iterator();
}
- public boolean contains(Object obj) {
+ public boolean contains(final Object obj) {
return map.containsKey(obj);
}
- public boolean containsAll(Collection<?> coll) {
+ public boolean containsAll(final Collection<?> coll) {
return map.keySet().containsAll(coll);
}
- public boolean add(E obj) {
- int size = map.size();
+ public boolean add(final E obj) {
+ final int size = map.size();
map.put(obj, dummyValue);
return map.size() != size;
}
- public boolean addAll(Collection<? extends E> coll) {
- int size = map.size();
- for (E e : coll) {
+ public boolean addAll(final Collection<? extends E> coll) {
+ final int size = map.size();
+ for (final E e : coll) {
map.put(e, dummyValue);
}
return map.size() != size;
}
- public boolean remove(Object obj) {
- int size = map.size();
+ public boolean remove(final Object obj) {
+ final int size = map.size();
map.remove(obj);
return map.size() != size;
}
- public boolean removeAll(Collection<?> coll) {
+ public boolean removeAll(final Collection<?> coll) {
return map.keySet().removeAll(coll);
}
- public boolean retainAll(Collection<?> coll) {
+ public boolean retainAll(final Collection<?> coll) {
return map.keySet().retainAll(coll);
}
@@ -147,12 +147,12 @@ public final class MapBackedSet<E, V> im
return map.keySet().toArray();
}
- public <T> T[] toArray(T[] array) {
+ public <T> T[] toArray(final T[] array) {
return map.keySet().toArray(array);
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
return map.keySet().equals(obj);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSet.java Mon Jan 7 17:15:14 2013
@@ -55,7 +55,7 @@ public class PredicatedSet<E> extends Pr
* @throws IllegalArgumentException if set or predicate is null
* @throws IllegalArgumentException if the set contains invalid elements
*/
- public static <E> PredicatedSet<E> predicatedSet(Set<E> set, Predicate<? super E> predicate) {
+ public static <E> PredicatedSet<E> predicatedSet(final Set<E> set, final Predicate<? super E> predicate) {
return new PredicatedSet<E>(set, predicate);
}
@@ -71,7 +71,7 @@ public class PredicatedSet<E> extends Pr
* @throws IllegalArgumentException if set or predicate is null
* @throws IllegalArgumentException if the set contains invalid elements
*/
- protected PredicatedSet(Set<E> set, Predicate<? super E> predicate) {
+ protected PredicatedSet(final Set<E> set, final Predicate<? super E> predicate) {
super(set, predicate);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSortedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSortedSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSortedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/PredicatedSortedSet.java Mon Jan 7 17:15:14 2013
@@ -55,7 +55,7 @@ public class PredicatedSortedSet<E> exte
* @throws IllegalArgumentException if set or predicate is null
* @throws IllegalArgumentException if the set contains invalid elements
*/
- public static <E> PredicatedSortedSet<E> predicatedSortedSet(SortedSet<E> set, Predicate<? super E> predicate) {
+ public static <E> PredicatedSortedSet<E> predicatedSortedSet(final SortedSet<E> set, final Predicate<? super E> predicate) {
return new PredicatedSortedSet<E>(set, predicate);
}
@@ -71,7 +71,7 @@ public class PredicatedSortedSet<E> exte
* @throws IllegalArgumentException if set or predicate is null
* @throws IllegalArgumentException if the set contains invalid elements
*/
- protected PredicatedSortedSet(SortedSet<E> set, Predicate<? super E> predicate) {
+ protected PredicatedSortedSet(final SortedSet<E> set, final Predicate<? super E> predicate) {
super(set, predicate);
}
@@ -98,18 +98,18 @@ public class PredicatedSortedSet<E> exte
return decorated().last();
}
- public SortedSet<E> subSet(E fromElement, E toElement) {
- SortedSet<E> sub = decorated().subSet(fromElement, toElement);
+ public SortedSet<E> subSet(final E fromElement, final E toElement) {
+ final SortedSet<E> sub = decorated().subSet(fromElement, toElement);
return new PredicatedSortedSet<E>(sub, predicate);
}
- public SortedSet<E> headSet(E toElement) {
- SortedSet<E> sub = decorated().headSet(toElement);
+ public SortedSet<E> headSet(final E toElement) {
+ final SortedSet<E> sub = decorated().headSet(toElement);
return new PredicatedSortedSet<E>(sub, predicate);
}
- public SortedSet<E> tailSet(E fromElement) {
- SortedSet<E> sub = decorated().tailSet(fromElement);
+ public SortedSet<E> tailSet(final E fromElement) {
+ final SortedSet<E> sub = decorated().tailSet(fromElement);
return new PredicatedSortedSet<E>(sub, predicate);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSet.java Mon Jan 7 17:15:14 2013
@@ -44,7 +44,7 @@ public class SynchronizedSet<E> extends
* @return a new synchronized set
* @throws IllegalArgumentException if set is null
*/
- public static <E> SynchronizedSet<E> synchronizedSet(Set<E> set) {
+ public static <E> SynchronizedSet<E> synchronizedSet(final Set<E> set) {
return new SynchronizedSet<E>(set);
}
@@ -55,7 +55,7 @@ public class SynchronizedSet<E> extends
* @param set the set to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
- protected SynchronizedSet(Set<E> set) {
+ protected SynchronizedSet(final Set<E> set) {
super(set);
}
@@ -66,7 +66,7 @@ public class SynchronizedSet<E> extends
* @param lock the lock object to use, must not be null
* @throws IllegalArgumentException if set is null
*/
- protected SynchronizedSet(Set<E> set, Object lock) {
+ protected SynchronizedSet(final Set<E> set, final Object lock) {
super(set, lock);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSortedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSortedSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSortedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/SynchronizedSortedSet.java Mon Jan 7 17:15:14 2013
@@ -45,7 +45,7 @@ public class SynchronizedSortedSet<E> ex
* @return a new synchronized sorted set
* @throws IllegalArgumentException if set is null
*/
- public static <E> SynchronizedSortedSet<E> synchronizedSortedSet(SortedSet<E> set) {
+ public static <E> SynchronizedSortedSet<E> synchronizedSortedSet(final SortedSet<E> set) {
return new SynchronizedSortedSet<E>(set);
}
@@ -56,7 +56,7 @@ public class SynchronizedSortedSet<E> ex
* @param set the set to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
- protected SynchronizedSortedSet(SortedSet<E> set) {
+ protected SynchronizedSortedSet(final SortedSet<E> set) {
super(set);
}
@@ -67,7 +67,7 @@ public class SynchronizedSortedSet<E> ex
* @param lock the lock object to use, must not be null
* @throws IllegalArgumentException if set is null
*/
- protected SynchronizedSortedSet(SortedSet<E> set, Object lock) {
+ protected SynchronizedSortedSet(final SortedSet<E> set, final Object lock) {
super(set, lock);
}
@@ -81,27 +81,27 @@ public class SynchronizedSortedSet<E> ex
}
//-----------------------------------------------------------------------
- public SortedSet<E> subSet(E fromElement, E toElement) {
+ public SortedSet<E> subSet(final E fromElement, final E toElement) {
synchronized (lock) {
- SortedSet<E> set = getSortedSet().subSet(fromElement, toElement);
+ final SortedSet<E> set = getSortedSet().subSet(fromElement, toElement);
// the lock is passed into the constructor here to ensure that the
// subset is synchronized on the same lock as the parent
return new SynchronizedSortedSet<E>(set, lock);
}
}
- public SortedSet<E> headSet(E toElement) {
+ public SortedSet<E> headSet(final E toElement) {
synchronized (lock) {
- SortedSet<E> set = getSortedSet().headSet(toElement);
+ final SortedSet<E> set = getSortedSet().headSet(toElement);
// the lock is passed into the constructor here to ensure that the
// headset is synchronized on the same lock as the parent
return new SynchronizedSortedSet<E>(set, lock);
}
}
- public SortedSet<E> tailSet(E fromElement) {
+ public SortedSet<E> tailSet(final E fromElement) {
synchronized (lock) {
- SortedSet<E> set = getSortedSet().tailSet(fromElement);
+ final SortedSet<E> set = getSortedSet().tailSet(fromElement);
// the lock is passed into the constructor here to ensure that the
// tailset is synchronized on the same lock as the parent
return new SynchronizedSortedSet<E>(set, lock);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSet.java Mon Jan 7 17:15:14 2013
@@ -52,7 +52,7 @@ public class TransformedSet<E> extends T
* @return a new transformed set
* @throws IllegalArgumentException if set or transformer is null
*/
- public static <E> TransformedSet<E> transformingSet(Set<E> set, Transformer<? super E, ? extends E> transformer) {
+ public static <E> TransformedSet<E> transformingSet(final Set<E> set, final Transformer<? super E, ? extends E> transformer) {
return new TransformedSet<E>(set, transformer);
}
@@ -71,13 +71,14 @@ public class TransformedSet<E> extends T
* @throws IllegalArgumentException if set or transformer is null
* @since 3.3
*/
- public static <E> Set<E> transformedSet(Set<E> set, Transformer<? super E, ? extends E> transformer) {
- TransformedSet<E> decorated = new TransformedSet<E>(set, transformer);
+ public static <E> Set<E> transformedSet(final Set<E> set, final Transformer<? super E, ? extends E> transformer) {
+ final TransformedSet<E> decorated = new TransformedSet<E>(set, transformer);
if (transformer != null && set != null && set.size() > 0) {
@SuppressWarnings("unchecked") // set is type E
+ final
E[] values = (E[]) set.toArray();
set.clear();
- for (E value : values) {
+ for (final E value : values) {
decorated.decorated().add(transformer.transform(value));
}
}
@@ -95,7 +96,7 @@ public class TransformedSet<E> extends T
* @param transformer the transformer to use for conversion, must not be null
* @throws IllegalArgumentException if set or transformer is null
*/
- protected TransformedSet(Set<E> set, Transformer<? super E, ? extends E> transformer) {
+ protected TransformedSet(final Set<E> set, final Transformer<? super E, ? extends E> transformer) {
super(set, transformer);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/TransformedSortedSet.java Mon Jan 7 17:15:14 2013
@@ -52,8 +52,8 @@ public class TransformedSortedSet<E> ext
* @return a new transformed {@link SortedSet}
* @throws IllegalArgumentException if set or transformer is null
*/
- public static <E> TransformedSortedSet<E> transformingSortedSet(SortedSet<E> set,
- Transformer<? super E, ? extends E> transformer) {
+ public static <E> TransformedSortedSet<E> transformingSortedSet(final SortedSet<E> set,
+ final Transformer<? super E, ? extends E> transformer) {
return new TransformedSortedSet<E>(set, transformer);
}
@@ -72,14 +72,15 @@ public class TransformedSortedSet<E> ext
* @throws IllegalArgumentException if set or transformer is null
* @since 3.3
*/
- public static <E> TransformedSortedSet<E> transformedSortedSet(SortedSet<E> set,
- Transformer<? super E, ? extends E> transformer) {
- TransformedSortedSet<E> decorated = new TransformedSortedSet<E>(set, transformer);
+ public static <E> TransformedSortedSet<E> transformedSortedSet(final SortedSet<E> set,
+ final Transformer<? super E, ? extends E> transformer) {
+ final TransformedSortedSet<E> decorated = new TransformedSortedSet<E>(set, transformer);
if (transformer != null && set != null && set.size() > 0) {
@SuppressWarnings("unchecked") // set is type E
+ final
E[] values = (E[]) set.toArray();
set.clear();
- for (E value : values) {
+ for (final E value : values) {
decorated.decorated().add(transformer.transform(value));
}
}
@@ -97,7 +98,7 @@ public class TransformedSortedSet<E> ext
* @param transformer the transformer to use for conversion, must not be null
* @throws IllegalArgumentException if set or transformer is null
*/
- protected TransformedSortedSet(SortedSet<E> set, Transformer<? super E, ? extends E> transformer) {
+ protected TransformedSortedSet(final SortedSet<E> set, final Transformer<? super E, ? extends E> transformer) {
super(set, transformer);
}
@@ -124,18 +125,18 @@ public class TransformedSortedSet<E> ext
}
//-----------------------------------------------------------------------
- public SortedSet<E> subSet(E fromElement, E toElement) {
- SortedSet<E> set = getSortedSet().subSet(fromElement, toElement);
+ public SortedSet<E> subSet(final E fromElement, final E toElement) {
+ final SortedSet<E> set = getSortedSet().subSet(fromElement, toElement);
return new TransformedSortedSet<E>(set, transformer);
}
- public SortedSet<E> headSet(E toElement) {
- SortedSet<E> set = getSortedSet().headSet(toElement);
+ public SortedSet<E> headSet(final E toElement) {
+ final SortedSet<E> set = getSortedSet().headSet(toElement);
return new TransformedSortedSet<E>(set, transformer);
}
- public SortedSet<E> tailSet(E fromElement) {
- SortedSet<E> set = getSortedSet().tailSet(fromElement);
+ public SortedSet<E> tailSet(final E fromElement) {
+ final SortedSet<E> set = getSortedSet().tailSet(fromElement);
return new TransformedSortedSet<E>(set, transformer);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSet.java Mon Jan 7 17:15:14 2013
@@ -48,7 +48,7 @@ public final class UnmodifiableSet<E>
* @return a new unmodifiable set
* @throws IllegalArgumentException if set is null
*/
- public static <E> Set<E> unmodifiableSet(Set<E> set) {
+ public static <E> Set<E> unmodifiableSet(final Set<E> set) {
if (set instanceof Unmodifiable) {
return set;
}
@@ -62,7 +62,7 @@ public final class UnmodifiableSet<E>
* @param set the set to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
- private UnmodifiableSet(Set<E> set) {
+ private UnmodifiableSet(final Set<E> set) {
super(set);
}
@@ -73,12 +73,12 @@ public final class UnmodifiableSet<E>
}
@Override
- public boolean add(E object) {
+ public boolean add(final E object) {
throw new UnsupportedOperationException();
}
@Override
- public boolean addAll(Collection<? extends E> coll) {
+ public boolean addAll(final Collection<? extends E> coll) {
throw new UnsupportedOperationException();
}
@@ -88,17 +88,17 @@ public final class UnmodifiableSet<E>
}
@Override
- public boolean remove(Object object) {
+ public boolean remove(final Object object) {
throw new UnsupportedOperationException();
}
@Override
- public boolean removeAll(Collection<?> coll) {
+ public boolean removeAll(final Collection<?> coll) {
throw new UnsupportedOperationException();
}
@Override
- public boolean retainAll(Collection<?> coll) {
+ public boolean retainAll(final Collection<?> coll) {
throw new UnsupportedOperationException();
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java Mon Jan 7 17:15:14 2013
@@ -52,7 +52,7 @@ public final class UnmodifiableSortedSet
* @return a new unmodifiable {@link SortedSet}
* @throws IllegalArgumentException if set is null
*/
- public static <E> SortedSet<E> unmodifiableSortedSet(SortedSet<E> set) {
+ public static <E> SortedSet<E> unmodifiableSortedSet(final SortedSet<E> set) {
if (set instanceof Unmodifiable) {
return set;
}
@@ -66,7 +66,7 @@ public final class UnmodifiableSortedSet
* @param out the output stream
* @throws IOException
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(collection);
}
@@ -79,7 +79,7 @@ public final class UnmodifiableSortedSet
* @throws ClassNotFoundException
*/
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
collection = (Collection<E>) in.readObject(); // (1)
}
@@ -91,7 +91,7 @@ public final class UnmodifiableSortedSet
* @param set the set to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
- private UnmodifiableSortedSet(SortedSet<E> set) {
+ private UnmodifiableSortedSet(final SortedSet<E> set) {
super(set);
}
@@ -102,12 +102,12 @@ public final class UnmodifiableSortedSet
}
@Override
- public boolean add(E object) {
+ public boolean add(final E object) {
throw new UnsupportedOperationException();
}
@Override
- public boolean addAll(Collection<? extends E> coll) {
+ public boolean addAll(final Collection<? extends E> coll) {
throw new UnsupportedOperationException();
}
@@ -117,36 +117,36 @@ public final class UnmodifiableSortedSet
}
@Override
- public boolean remove(Object object) {
+ public boolean remove(final Object object) {
throw new UnsupportedOperationException();
}
@Override
- public boolean removeAll(Collection<?> coll) {
+ public boolean removeAll(final Collection<?> coll) {
throw new UnsupportedOperationException();
}
@Override
- public boolean retainAll(Collection<?> coll) {
+ public boolean retainAll(final Collection<?> coll) {
throw new UnsupportedOperationException();
}
//-----------------------------------------------------------------------
@Override
- public SortedSet<E> subSet(E fromElement, E toElement) {
- SortedSet<E> sub = decorated().subSet(fromElement, toElement);
+ public SortedSet<E> subSet(final E fromElement, final E toElement) {
+ final SortedSet<E> sub = decorated().subSet(fromElement, toElement);
return new UnmodifiableSortedSet<E>(sub);
}
@Override
- public SortedSet<E> headSet(E toElement) {
- SortedSet<E> sub = decorated().headSet(toElement);
+ public SortedSet<E> headSet(final E toElement) {
+ final SortedSet<E> sub = decorated().headSet(toElement);
return new UnmodifiableSortedSet<E>(sub);
}
@Override
- public SortedSet<E> tailSet(E fromElement) {
- SortedSet<E> sub = decorated().tailSet(fromElement);
+ public SortedSet<E> tailSet(final E fromElement) {
+ final SortedSet<E> sub = decorated().tailSet(fromElement);
return new UnmodifiableSortedSet<E>(sub);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java Mon Jan 7 17:15:14 2013
@@ -40,7 +40,7 @@ public class AbstractIterableGetMapDecor
* Create a new AbstractSplitMapDecorator.
* @param decorated the Map to decorate
*/
- public AbstractIterableGetMapDecorator(Map<K, V> decorated) {
+ public AbstractIterableGetMapDecorator(final Map<K, V> decorated) {
this.map = decorated;
}
@@ -63,14 +63,14 @@ public class AbstractIterableGetMapDecor
/**
* {@inheritDoc}
*/
- public boolean containsKey(Object key) {
+ public boolean containsKey(final Object key) {
return decorated().containsKey(key);
}
/**
* {@inheritDoc}
*/
- public boolean containsValue(Object value) {
+ public boolean containsValue(final Object value) {
return decorated().containsValue(value);
}
@@ -84,14 +84,14 @@ public class AbstractIterableGetMapDecor
/**
* {@inheritDoc}
*/
- public V get(Object key) {
+ public V get(final Object key) {
return decorated().get(key);
}
/**
* {@inheritDoc}
*/
- public V remove(Object key) {
+ public V remove(final Object key) {
return decorated().remove(key);
}
@@ -135,7 +135,7 @@ public class AbstractIterableGetMapDecor
* {@inheritDoc}
*/
@Override
- public boolean equals(Object object) {
+ public boolean equals(final Object object) {
if (object == this) {
return true;
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/splitmap/TransformedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/splitmap/TransformedMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/splitmap/TransformedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/splitmap/TransformedMap.java Mon Jan 7 17:15:14 2013
@@ -82,9 +82,9 @@ public class TransformedMap<J, K, U, V>
* means no transformation
* @throws IllegalArgumentException if map is null
*/
- public static <J, K, U, V> TransformedMap<J, K, U, V> transformingMap(Map<K, V> map,
- Transformer<? super J, ? extends K> keyTransformer,
- Transformer<? super U, ? extends V> valueTransformer) {
+ public static <J, K, U, V> TransformedMap<J, K, U, V> transformingMap(final Map<K, V> map,
+ final Transformer<? super J, ? extends K> keyTransformer,
+ final Transformer<? super U, ? extends V> valueTransformer) {
return new TransformedMap<J, K, U, V>(map, keyTransformer, valueTransformer);
}
@@ -102,8 +102,8 @@ public class TransformedMap<J, K, U, V>
* means no conversion
* @throws IllegalArgumentException if map is null
*/
- protected TransformedMap(Map<K, V> map, Transformer<? super J, ? extends K> keyTransformer,
- Transformer<? super U, ? extends V> valueTransformer) {
+ protected TransformedMap(final Map<K, V> map, final Transformer<? super J, ? extends K> keyTransformer,
+ final Transformer<? super U, ? extends V> valueTransformer) {
super(map);
if (keyTransformer == null) {
throw new IllegalArgumentException("keyTransformer cannot be null");
@@ -122,7 +122,7 @@ public class TransformedMap<J, K, U, V>
* @param out the output stream
* @throws IOException
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(decorated());
}
@@ -136,7 +136,7 @@ public class TransformedMap<J, K, U, V>
* @since 3.1
*/
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
map = (Map<K, V>) in.readObject(); // (1)
}
@@ -150,7 +150,7 @@ public class TransformedMap<J, K, U, V>
* @param object the object to transform
* @return the transformed object
*/
- protected K transformKey(J object) {
+ protected K transformKey(final J object) {
return keyTransformer.transform(object);
}
@@ -162,7 +162,7 @@ public class TransformedMap<J, K, U, V>
* @param object the object to transform
* @return the transformed object
*/
- protected V transformValue(U object) {
+ protected V transformValue(final U object) {
return valueTransformer.transform(object);
}
@@ -175,13 +175,13 @@ public class TransformedMap<J, K, U, V>
* @return the transformed object
*/
@SuppressWarnings("unchecked")
- protected Map<K, V> transformMap(Map<? extends J, ? extends U> map) {
+ protected Map<K, V> transformMap(final Map<? extends J, ? extends U> map) {
if (map.isEmpty()) {
return (Map<K, V>) map;
}
- Map<K, V> result = new LinkedMap<K, V>(map.size());
+ final Map<K, V> result = new LinkedMap<K, V>(map.size());
- for (Map.Entry<? extends J, ? extends U> entry : map.entrySet()) {
+ for (final Map.Entry<? extends J, ? extends U> entry : map.entrySet()) {
result.put(transformKey(entry.getKey()), transformValue(entry.getValue()));
}
return result;
@@ -193,7 +193,7 @@ public class TransformedMap<J, K, U, V>
* @param value the value to transform
* @return the transformed value
*/
- protected V checkSetValue(U value) {
+ protected V checkSetValue(final U value) {
return valueTransformer.transform(value);
}
@@ -201,14 +201,14 @@ public class TransformedMap<J, K, U, V>
/**
* {@inheritDoc}
*/
- public V put(J key, U value) {
+ public V put(final J key, final U value) {
return decorated().put(transformKey(key), transformValue(value));
}
/**
* {@inheritDoc}
*/
- public void putAll(Map<? extends J, ? extends U> mapToCopy) {
+ public void putAll(final Map<? extends J, ? extends U> mapToCopy) {
decorated().putAll(transformMap(mapToCopy));
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/AbstractKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/AbstractKeyAnalyzer.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/AbstractKeyAnalyzer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/AbstractKeyAnalyzer.java Mon Jan 7 17:15:14 2013
@@ -30,7 +30,7 @@ public abstract class AbstractKeyAnalyze
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public int compare(K o1, K o2) {
+ public int compare(final K o1, final K o2) {
if (o1 == null) {
return o2 == null ? 0 : -1;
} else if (o2 == null) {
@@ -43,21 +43,21 @@ public abstract class AbstractKeyAnalyze
/**
* Returns true if bitIndex is a {@link KeyAnalyzer#OUT_OF_BOUNDS_BIT_KEY}
*/
- static boolean isOutOfBoundsIndex(int bitIndex) {
+ static boolean isOutOfBoundsIndex(final int bitIndex) {
return bitIndex == OUT_OF_BOUNDS_BIT_KEY;
}
/**
* Returns true if bitIndex is a {@link KeyAnalyzer#EQUAL_BIT_KEY}
*/
- static boolean isEqualBitKey(int bitIndex) {
+ static boolean isEqualBitKey(final int bitIndex) {
return bitIndex == EQUAL_BIT_KEY;
}
/**
* Returns true if bitIndex is a {@link KeyAnalyzer#NULL_BIT_KEY}
*/
- static boolean isNullBitKey(int bitIndex) {
+ static boolean isNullBitKey(final int bitIndex) {
return bitIndex == NULL_BIT_KEY;
}
@@ -66,7 +66,7 @@ public abstract class AbstractKeyAnalyze
* are considered valid if they're between 0 and
* {@link Integer#MAX_VALUE}
*/
- static boolean isValidBitIndex(int bitIndex) {
+ static boolean isValidBitIndex(final int bitIndex) {
return 0 <= bitIndex && bitIndex <= Integer.MAX_VALUE;
}
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/AbstractTrie.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/AbstractTrie.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/AbstractTrie.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/AbstractTrie.java Mon Jan 7 17:15:14 2013
@@ -43,7 +43,7 @@ abstract class AbstractTrie<K, V> extend
/**
* Constructs a new {@link Trie} using the given {@link KeyAnalyzer}.
*/
- public AbstractTrie(KeyAnalyzer<? super K> keyAnalyzer) {
+ public AbstractTrie(final KeyAnalyzer<? super K> keyAnalyzer) {
if (keyAnalyzer == null) {
throw new NullPointerException("keyAnalyzer");
}
@@ -61,8 +61,8 @@ abstract class AbstractTrie<K, V> extend
/**
* {@inheritDoc}
*/
- public K selectKey(K key) {
- Map.Entry<K, V> entry = select(key);
+ public K selectKey(final K key) {
+ final Map.Entry<K, V> entry = select(key);
if (entry == null) {
return null;
}
@@ -72,8 +72,8 @@ abstract class AbstractTrie<K, V> extend
/**
* {@inheritDoc}
*/
- public V selectValue(K key) {
- Map.Entry<K, V> entry = select(key);
+ public V selectValue(final K key) {
+ final Map.Entry<K, V> entry = select(key);
if (entry == null) {
return null;
}
@@ -82,9 +82,9 @@ abstract class AbstractTrie<K, V> extend
@Override
public String toString() {
- StringBuilder buffer = new StringBuilder();
+ final StringBuilder buffer = new StringBuilder();
buffer.append("Trie[").append(size()).append("]={\n");
- for (Map.Entry<K, V> entry : entrySet()) {
+ for (final Map.Entry<K, V> entry : entrySet()) {
buffer.append(" ").append(entry).append("\n");
}
buffer.append("}\n");
@@ -96,7 +96,7 @@ abstract class AbstractTrie<K, V> extend
* cast anything. It's just fooling the compiler!
*/
@SuppressWarnings("unchecked")
- final K castKey(Object key) {
+ final K castKey(final Object key) {
return (K)key;
}
@@ -105,7 +105,7 @@ abstract class AbstractTrie<K, V> extend
*
* @see KeyAnalyzer#lengthInBits(Object)
*/
- final int lengthInBits(K key) {
+ final int lengthInBits(final K key) {
if (key == null) {
return 0;
}
@@ -128,7 +128,7 @@ abstract class AbstractTrie<K, V> extend
*
* @see KeyAnalyzer#isBitSet(Object, int, int)
*/
- final boolean isBitSet(K key, int bitIndex, int lengthInBits) {
+ final boolean isBitSet(final K key, final int bitIndex, final int lengthInBits) {
if (key == null) { // root's might be null!
return false;
}
@@ -138,7 +138,7 @@ abstract class AbstractTrie<K, V> extend
/**
* Utility method for calling {@link KeyAnalyzer#bitIndex(Object, int, int, Object, int, int)}
*/
- final int bitIndex(K key, K foundKey) {
+ final int bitIndex(final K key, final K foundKey) {
return keyAnalyzer.bitIndex(key, 0, lengthInBits(key),
foundKey, 0, lengthInBits(foundKey));
}
@@ -146,7 +146,7 @@ abstract class AbstractTrie<K, V> extend
/**
* An utility method for calling {@link KeyAnalyzer#compare(Object, Object)}
*/
- final boolean compareKeys(K key, K other) {
+ final boolean compareKeys(final K key, final K other) {
if (key == null) {
return other == null;
} else if (other == null) {
@@ -159,7 +159,7 @@ abstract class AbstractTrie<K, V> extend
/**
* Returns true if both values are either null or equal
*/
- static boolean compare(Object a, Object b) {
+ static boolean compare(final Object a, final Object b) {
return a == null ? b == null : a.equals(b);
}
@@ -176,12 +176,12 @@ abstract class AbstractTrie<K, V> extend
private final int hashCode;
- public BasicEntry(K key) {
+ public BasicEntry(final K key) {
this.key = key;
this.hashCode = key != null ? key.hashCode() : 0;
}
- public BasicEntry(K key, V value) {
+ public BasicEntry(final K key, final V value) {
this.key = key;
this.value = value;
@@ -193,7 +193,7 @@ abstract class AbstractTrie<K, V> extend
* Replaces the current key and value with the provided
* key & value
*/
- public V setKeyValue(K key, V value) {
+ public V setKeyValue(final K key, final V value) {
this.key = key;
return setValue(value);
}
@@ -215,8 +215,8 @@ abstract class AbstractTrie<K, V> extend
/**
* {@inheritDoc}
*/
- public V setValue(V value) {
- V previous = this.value;
+ public V setValue(final V value) {
+ final V previous = this.value;
this.value = value;
return previous;
}
@@ -227,14 +227,14 @@ abstract class AbstractTrie<K, V> extend
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o == this) {
return true;
} else if (!(o instanceof Map.Entry)) {
return false;
}
- Map.Entry<?, ?> other = (Map.Entry<?, ?>)o;
+ final Map.Entry<?, ?> other = (Map.Entry<?, ?>)o;
if (compare(key, other.getKey())
&& compare(value, other.getValue())) {
return true;
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ByteArrayKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ByteArrayKeyAnalyzer.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ByteArrayKeyAnalyzer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ByteArrayKeyAnalyzer.java Mon Jan 7 17:15:14 2013
@@ -52,7 +52,7 @@ public class ByteArrayKeyAnalyzer extend
*/
private final int maxLengthInBits;
- public ByteArrayKeyAnalyzer(int maxLengthInBits) {
+ public ByteArrayKeyAnalyzer(final int maxLengthInBits) {
if (maxLengthInBits < 0) {
throw new IllegalArgumentException(
"maxLengthInBits=" + maxLengthInBits);
@@ -64,7 +64,7 @@ public class ByteArrayKeyAnalyzer extend
/**
* Returns a bit mask where the given bit is set
*/
- private static int mask(int bit) {
+ private static int mask(final int bit) {
return MSB >>> bit;
}
@@ -86,58 +86,58 @@ public class ByteArrayKeyAnalyzer extend
/**
* {@inheritDoc}
*/
- public int lengthInBits(byte[] key) {
+ public int lengthInBits(final byte[] key) {
return key != null ? key.length * bitsPerElement() : 0;
}
/**
* {@inheritDoc}
*/
- public boolean isBitSet(byte[] key, int bitIndex, int lengthInBits) {
+ public boolean isBitSet(final byte[] key, final int bitIndex, final int lengthInBits) {
if (key == null) {
return false;
}
- int prefix = maxLengthInBits - lengthInBits;
- int keyBitIndex = bitIndex - prefix;
+ final int prefix = maxLengthInBits - lengthInBits;
+ final int keyBitIndex = bitIndex - prefix;
if (keyBitIndex >= lengthInBits || keyBitIndex < 0) {
return false;
}
- int index = keyBitIndex / LENGTH;
- int bit = keyBitIndex % LENGTH;
+ final int index = keyBitIndex / LENGTH;
+ final int bit = keyBitIndex % LENGTH;
return (key[index] & mask(bit)) != 0;
}
/**
* {@inheritDoc}
*/
- public int bitIndex(byte[] key, int offsetInBits, int lengthInBits,
- byte[] other, int otherOffsetInBits, int otherLengthInBits) {
+ public int bitIndex(final byte[] key, final int offsetInBits, final int lengthInBits,
+ byte[] other, final int otherOffsetInBits, final int otherLengthInBits) {
if (other == null) {
other = NULL;
}
boolean allNull = true;
- int length = Math.max(lengthInBits, otherLengthInBits);
- int prefix = maxLengthInBits - length;
+ final int length = Math.max(lengthInBits, otherLengthInBits);
+ final int prefix = maxLengthInBits - length;
if (prefix < 0) {
return KeyAnalyzer.OUT_OF_BOUNDS_BIT_KEY;
}
for (int i = 0; i < length; i++) {
- int index = prefix + offsetInBits + i;
- boolean value = isBitSet(key, index, lengthInBits);
+ final int index = prefix + offsetInBits + i;
+ final boolean value = isBitSet(key, index, lengthInBits);
if (value) {
allNull = false;
}
- int otherIndex = prefix + otherOffsetInBits + i;
- boolean otherValue = isBitSet(other, otherIndex, otherLengthInBits);
+ final int otherIndex = prefix + otherOffsetInBits + i;
+ final boolean otherValue = isBitSet(other, otherIndex, otherLengthInBits);
if (value != otherValue) {
return index;
@@ -154,15 +154,15 @@ public class ByteArrayKeyAnalyzer extend
/**
* {@inheritDoc}
*/
- public boolean isPrefix(byte[] prefix, int offsetInBits,
- int lengthInBits, byte[] key) {
+ public boolean isPrefix(final byte[] prefix, final int offsetInBits,
+ final int lengthInBits, final byte[] key) {
- int keyLength = lengthInBits(key);
+ final int keyLength = lengthInBits(key);
if (lengthInBits > keyLength) {
return false;
}
- int elements = lengthInBits - offsetInBits;
+ final int elements = lengthInBits - offsetInBits;
for (int i = 0; i < elements; i++) {
if (isBitSet(prefix, i+offsetInBits, lengthInBits)
!= isBitSet(key, i, keyLength)) {
@@ -177,7 +177,7 @@ public class ByteArrayKeyAnalyzer extend
* {@inheritDoc}
*/
@Override
- public int compare(byte[] o1, byte[] o2) {
+ public int compare(final byte[] o1, final byte[] o2) {
if (o1 == null) {
return o2 == null ? 0 : -1;
} else if (o2 == null) {
@@ -189,7 +189,7 @@ public class ByteArrayKeyAnalyzer extend
}
for (int i = 0; i < o1.length; i++) {
- int diff = (o1[i] & 0xFF) - (o2[i] & 0xFF);
+ final int diff = (o1[i] & 0xFF) - (o2[i] & 0xFF);
if (diff != 0) {
return diff;
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ByteKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ByteKeyAnalyzer.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ByteKeyAnalyzer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/ByteKeyAnalyzer.java Mon Jan 7 17:15:14 2013
@@ -44,7 +44,7 @@ public class ByteKeyAnalyzer extends Abs
/**
* Returns a bit mask where the given bit is set
*/
- private static int mask(int bit) {
+ private static int mask(final int bit) {
return MSB >>> bit;
}
@@ -58,37 +58,37 @@ public class ByteKeyAnalyzer extends Abs
/**
* {@inheritDoc}
*/
- public int lengthInBits(Byte key) {
+ public int lengthInBits(final Byte key) {
return LENGTH;
}
/**
* {@inheritDoc}
*/
- public boolean isBitSet(Byte key, int bitIndex, int lengthInBits) {
+ public boolean isBitSet(final Byte key, final int bitIndex, final int lengthInBits) {
return (key & mask(bitIndex)) != 0;
}
/**
* {@inheritDoc}
*/
- public int bitIndex(Byte key, int offsetInBits, int lengthInBits,
- Byte other, int otherOffsetInBits, int otherLengthInBits) {
+ public int bitIndex(final Byte key, final int offsetInBits, final int lengthInBits,
+ final Byte other, final int otherOffsetInBits, final int otherLengthInBits) {
if (offsetInBits != 0 || otherOffsetInBits != 0) {
throw new IllegalArgumentException("offsetInBits=" + offsetInBits
+ ", otherOffsetInBits=" + otherOffsetInBits);
}
- byte keyValue = key.byteValue();
+ final byte keyValue = key.byteValue();
if (keyValue == 0) {
return NULL_BIT_KEY;
}
- byte otherValue = other != null ? other.byteValue() : 0;
+ final byte otherValue = other != null ? other.byteValue() : 0;
if (keyValue != otherValue) {
- int xorValue = keyValue ^ otherValue;
+ final int xorValue = keyValue ^ otherValue;
for (int i = 0; i < LENGTH; i++) {
if ((xorValue & mask(i)) != 0) {
return i;
@@ -102,11 +102,11 @@ public class ByteKeyAnalyzer extends Abs
/**
* {@inheritDoc}
*/
- public boolean isPrefix(Byte prefix, int offsetInBits,
- int lengthInBits, Byte key) {
+ public boolean isPrefix(final Byte prefix, final int offsetInBits,
+ final int lengthInBits, final Byte key) {
- int value1 = prefix.byteValue() << offsetInBits;
- int value2 = key.byteValue();
+ final int value1 = prefix.byteValue() << offsetInBits;
+ final int value2 = key.byteValue();
int mask = 0;
for (int i = 0; i < lengthInBits; i++) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/CharArrayKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/CharArrayKeyAnalyzer.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/CharArrayKeyAnalyzer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/CharArrayKeyAnalyzer.java Mon Jan 7 17:15:14 2013
@@ -44,7 +44,7 @@ public class CharArrayKeyAnalyzer extend
/**
* Returns a bit mask where the given bit is set
*/
- private static int mask(int bit) {
+ private static int mask(final int bit) {
return MSB >>> bit;
}
@@ -58,15 +58,15 @@ public class CharArrayKeyAnalyzer extend
/**
* {@inheritDoc}
*/
- public int lengthInBits(char[] key) {
+ public int lengthInBits(final char[] key) {
return key != null ? key.length * LENGTH : 0;
}
/**
* {@inheritDoc}
*/
- public int bitIndex(char[] key, int offsetInBits, int lengthInBits,
- char[] other, int otherOffsetInBits, int otherLengthInBits) {
+ public int bitIndex(final char[] key, final int offsetInBits, final int lengthInBits,
+ final char[] other, final int otherOffsetInBits, final int otherLengthInBits) {
boolean allNull = true;
if (offsetInBits % LENGTH != 0 || otherOffsetInBits % LENGTH != 0
@@ -76,21 +76,21 @@ public class CharArrayKeyAnalyzer extend
}
- int beginIndex1 = offsetInBits / LENGTH;
- int beginIndex2 = otherOffsetInBits / LENGTH;
+ final int beginIndex1 = offsetInBits / LENGTH;
+ final int beginIndex2 = otherOffsetInBits / LENGTH;
- int endIndex1 = beginIndex1 + lengthInBits / LENGTH;
- int endIndex2 = beginIndex2 + otherLengthInBits / LENGTH;
+ final int endIndex1 = beginIndex1 + lengthInBits / LENGTH;
+ final int endIndex2 = beginIndex2 + otherLengthInBits / LENGTH;
- int length = Math.max(endIndex1, endIndex2);
+ final int length = Math.max(endIndex1, endIndex2);
// Look at each character, and if they're different
// then figure out which bit makes the difference
// and return it.
char k = 0, f = 0;
for(int i = 0; i < length; i++) {
- int index1 = beginIndex1 + i;
- int index2 = beginIndex2 + i;
+ final int index1 = beginIndex1 + i;
+ final int index2 = beginIndex2 + i;
if (index1 >= endIndex1) {
k = 0;
@@ -105,7 +105,7 @@ public class CharArrayKeyAnalyzer extend
}
if (k != f) {
- int x = k ^ f;
+ final int x = k ^ f;
return i * LENGTH + Integer.numberOfLeadingZeros(x) - LENGTH;
}
@@ -126,13 +126,13 @@ public class CharArrayKeyAnalyzer extend
/**
* {@inheritDoc}
*/
- public boolean isBitSet(char[] key, int bitIndex, int lengthInBits) {
+ public boolean isBitSet(final char[] key, final int bitIndex, final int lengthInBits) {
if (key == null || bitIndex >= lengthInBits) {
return false;
}
- int index = bitIndex / LENGTH;
- int bit = bitIndex % LENGTH;
+ final int index = bitIndex / LENGTH;
+ final int bit = bitIndex % LENGTH;
return (key[index] & mask(bit)) != 0;
}
@@ -140,15 +140,15 @@ public class CharArrayKeyAnalyzer extend
/**
* {@inheritDoc}
*/
- public boolean isPrefix(char[] prefix, int offsetInBits,
- int lengthInBits, char[] key) {
+ public boolean isPrefix(final char[] prefix, final int offsetInBits,
+ final int lengthInBits, final char[] key) {
if (offsetInBits % LENGTH != 0 || lengthInBits % LENGTH != 0) {
throw new IllegalArgumentException(
"Cannot determine prefix outside of Character boundaries");
}
- int off = offsetInBits / LENGTH;
- int len = lengthInBits / LENGTH;
+ final int off = offsetInBits / LENGTH;
+ final int len = lengthInBits / LENGTH;
for (int i = 0; i < len; i ++) {
if (prefix[i + off] != key[i]) {
return false;
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/CharacterKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/CharacterKeyAnalyzer.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/CharacterKeyAnalyzer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/CharacterKeyAnalyzer.java Mon Jan 7 17:15:14 2013
@@ -45,7 +45,7 @@ public class CharacterKeyAnalyzer extend
/**
* Returns a bit mask where the given bit is set
*/
- private static int mask(int bit) {
+ private static int mask(final int bit) {
return MSB >>> bit;
}
@@ -59,29 +59,29 @@ public class CharacterKeyAnalyzer extend
/**
* {@inheritDoc}
*/
- public int lengthInBits(Character key) {
+ public int lengthInBits(final Character key) {
return LENGTH;
}
/**
* {@inheritDoc}
*/
- public boolean isBitSet(Character key, int bitIndex, int lengthInBits) {
+ public boolean isBitSet(final Character key, final int bitIndex, final int lengthInBits) {
return (key & mask(bitIndex)) != 0;
}
/**
* {@inheritDoc}
*/
- public int bitIndex(Character key, int offsetInBits, int lengthInBits,
- Character other, int otherOffsetInBits, int otherLengthInBits) {
+ public int bitIndex(final Character key, final int offsetInBits, final int lengthInBits,
+ Character other, final int otherOffsetInBits, final int otherLengthInBits) {
if (offsetInBits != 0 || otherOffsetInBits != 0) {
throw new IllegalArgumentException("offsetInBits=" + offsetInBits
+ ", otherOffsetInBits=" + otherOffsetInBits);
}
- char keyValue = key.charValue();
+ final char keyValue = key.charValue();
if (keyValue == Character.MIN_VALUE) {
return NULL_BIT_KEY;
}
@@ -90,10 +90,10 @@ public class CharacterKeyAnalyzer extend
other = Character.MIN_VALUE;
}
- char otherValue = other != null ? other.charValue() : Character.MIN_VALUE;
+ final char otherValue = other != null ? other.charValue() : Character.MIN_VALUE;
if (keyValue != otherValue) {
- int xorValue = keyValue ^ otherValue;
+ final int xorValue = keyValue ^ otherValue;
for (int i = 0; i < LENGTH; i++) {
if ((xorValue & mask(i)) != 0) {
return i;
@@ -107,11 +107,11 @@ public class CharacterKeyAnalyzer extend
/**
* {@inheritDoc}
*/
- public boolean isPrefix(Character prefix, int offsetInBits,
- int lengthInBits, Character key) {
+ public boolean isPrefix(final Character prefix, final int offsetInBits,
+ final int lengthInBits, final Character key) {
- int value1 = prefix.charValue() << offsetInBits;
- int value2 = key.charValue();
+ final int value1 = prefix.charValue() << offsetInBits;
+ final int value2 = key.charValue();
int mask = 0;
for(int i = 0; i < lengthInBits; i++) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/IntegerKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/IntegerKeyAnalyzer.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/IntegerKeyAnalyzer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/IntegerKeyAnalyzer.java Mon Jan 7 17:15:14 2013
@@ -44,7 +44,7 @@ public class IntegerKeyAnalyzer extends
/**
* Returns a bit mask where the given bit is set
*/
- private static int mask(int bit) {
+ private static int mask(final int bit) {
return MSB >>> bit;
}
@@ -58,37 +58,37 @@ public class IntegerKeyAnalyzer extends
/**
* {@inheritDoc}
*/
- public int lengthInBits(Integer key) {
+ public int lengthInBits(final Integer key) {
return LENGTH;
}
/**
* {@inheritDoc}
*/
- public boolean isBitSet(Integer key, int bitIndex, int lengthInBits) {
+ public boolean isBitSet(final Integer key, final int bitIndex, final int lengthInBits) {
return (key & mask(bitIndex)) != 0;
}
/**
* {@inheritDoc}
*/
- public int bitIndex(Integer key, int offsetInBits, int lengthInBits,
- Integer other, int otherOffsetInBits, int otherLengthInBits) {
+ public int bitIndex(final Integer key, final int offsetInBits, final int lengthInBits,
+ final Integer other, final int otherOffsetInBits, final int otherLengthInBits) {
if (offsetInBits != 0 || otherOffsetInBits != 0) {
throw new IllegalArgumentException("offsetInBits=" + offsetInBits
+ ", otherOffsetInBits=" + otherOffsetInBits);
}
- int keyValue = key.intValue();
+ final int keyValue = key.intValue();
if (keyValue == 0) {
return NULL_BIT_KEY;
}
- int otherValue = other != null ? other.intValue() : 0;
+ final int otherValue = other != null ? other.intValue() : 0;
if (keyValue != otherValue) {
- int xorValue = keyValue ^ otherValue;
+ final int xorValue = keyValue ^ otherValue;
for (int i = 0; i < LENGTH; i++) {
if ((xorValue & mask(i)) != 0) {
return i;
@@ -102,11 +102,11 @@ public class IntegerKeyAnalyzer extends
/**
* {@inheritDoc}
*/
- public boolean isPrefix(Integer prefix, int offsetInBits,
- int lengthInBits, Integer key) {
+ public boolean isPrefix(final Integer prefix, final int offsetInBits,
+ final int lengthInBits, final Integer key) {
- int value1 = prefix.intValue() << offsetInBits;
- int value2 = key.intValue();
+ final int value1 = prefix.intValue() << offsetInBits;
+ final int value2 = key.intValue();
int mask = 0;
for (int i = 0; i < lengthInBits; i++) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/LongKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/LongKeyAnalyzer.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/LongKeyAnalyzer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/trie/LongKeyAnalyzer.java Mon Jan 7 17:15:14 2013
@@ -44,7 +44,7 @@ public class LongKeyAnalyzer extends Abs
/**
* Returns a bit mask where the given bit is set
*/
- private static long mask(int bit) {
+ private static long mask(final int bit) {
return MSB >>> bit;
}
@@ -58,37 +58,37 @@ public class LongKeyAnalyzer extends Abs
/**
* {@inheritDoc}
*/
- public int lengthInBits(Long key) {
+ public int lengthInBits(final Long key) {
return LENGTH;
}
/**
* {@inheritDoc}
*/
- public boolean isBitSet(Long key, int bitIndex, int lengthInBits) {
+ public boolean isBitSet(final Long key, final int bitIndex, final int lengthInBits) {
return (key & mask(bitIndex)) != 0;
}
/**
* {@inheritDoc}
*/
- public int bitIndex(Long key, int offsetInBits, int lengthInBits,
- Long other, int otherOffsetInBits, int otherLengthInBits) {
+ public int bitIndex(final Long key, final int offsetInBits, final int lengthInBits,
+ final Long other, final int otherOffsetInBits, final int otherLengthInBits) {
if (offsetInBits != 0 || otherOffsetInBits != 0) {
throw new IllegalArgumentException("offsetInBits=" + offsetInBits
+ ", otherOffsetInBits=" + otherOffsetInBits);
}
- long keyValue = key.longValue();
+ final long keyValue = key.longValue();
if (keyValue == 0L) {
return NULL_BIT_KEY;
}
- long otherValue = other != null ? other.longValue() : 0L;
+ final long otherValue = other != null ? other.longValue() : 0L;
if (keyValue != otherValue) {
- long xorValue = keyValue ^ otherValue;
+ final long xorValue = keyValue ^ otherValue;
for (int i = 0; i < LENGTH; i++) {
if ((xorValue & mask(i)) != 0L) {
return i;
@@ -102,11 +102,11 @@ public class LongKeyAnalyzer extends Abs
/**
* {@inheritDoc}
*/
- public boolean isPrefix(Long prefix, int offsetInBits,
- int lengthInBits, Long key) {
+ public boolean isPrefix(final Long prefix, final int offsetInBits,
+ final int lengthInBits, final Long key) {
- long value1 = prefix.longValue() << offsetInBits;
- long value2 = key.longValue();
+ final long value1 = prefix.longValue() << offsetInBits;
+ final long value2 = key.longValue();
long mask = 0L;
for (int i = 0; i < lengthInBits; i++) {