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 [12/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/map/MultiValueMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiValueMap.java Mon Jan 7 17:15:14 2013
@@ -80,7 +80,7 @@ public class MultiValueMap<K, V> extends
* @return a new multi-value map
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
- 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, ArrayList> multiValueMap((Map<K, ? super Collection>) map, ArrayList.class);
}
@@ -94,8 +94,8 @@ public class MultiValueMap<K, V> extends
* @param collectionClass the type of the collection class
* @return a new multi-value map
*/
- public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, ? super C> map,
- Class<C> collectionClass) {
+ public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(final Map<K, ? super C> map,
+ final Class<C> collectionClass) {
return new MultiValueMap<K, V>(map, new ReflectionFactory<C>(collectionClass));
}
@@ -109,8 +109,8 @@ public class MultiValueMap<K, V> extends
* @param collectionFactory the collection factory (must return a Collection object).
* @return a new multi-value map
*/
- public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(Map<K, ? super C> map,
- Factory<C> collectionFactory) {
+ public static <K, V, C extends Collection<V>> MultiValueMap<K, V> multiValueMap(final Map<K, ? super C> map,
+ final Factory<C> collectionFactory) {
return new MultiValueMap<K, V>(map, collectionFactory);
}
@@ -132,7 +132,7 @@ public class MultiValueMap<K, V> extends
* @param collectionFactory the collection factory which must return a Collection instance
*/
@SuppressWarnings("unchecked")
- protected <C extends Collection<V>> MultiValueMap(Map<K, ? super C> map, Factory<C> collectionFactory) {
+ protected <C extends Collection<V>> MultiValueMap(final Map<K, ? super C> map, final Factory<C> collectionFactory) {
super((Map<K, Object>) map);
if (collectionFactory == null) {
throw new IllegalArgumentException("The factory must not be null");
@@ -148,7 +148,7 @@ public class MultiValueMap<K, V> extends
* @throws IOException
* @since 3.3
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(map);
}
@@ -162,7 +162,7 @@ public class MultiValueMap<K, V> extends
* @since 3.3
*/
@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, Object>) in.readObject(); // (1)
}
@@ -198,12 +198,12 @@ public class MultiValueMap<K, V> extends
* @return the value removed (which was passed in), null if nothing removed
*/
@SuppressWarnings("unchecked")
- public V remove(Object key, Object value) {
- Collection<V> valuesForKey = getCollection(key);
+ public V remove(final Object key, final Object value) {
+ final Collection<V> valuesForKey = getCollection(key);
if (valuesForKey == null) {
return null;
}
- boolean removed = valuesForKey.remove(value);
+ final boolean removed = valuesForKey.remove(value);
if (removed == false) {
return null;
}
@@ -223,10 +223,10 @@ public class MultiValueMap<K, V> extends
*/
@Override
@SuppressWarnings("unchecked")
- public boolean containsValue(Object value) {
- Set<Map.Entry<K, Object>> pairs = decorated().entrySet();
+ public boolean containsValue(final Object value) {
+ final Set<Map.Entry<K, Object>> pairs = decorated().entrySet();
if (pairs != null) {
- for (Map.Entry<K, Object> entry : pairs) {
+ for (final Map.Entry<K, Object> entry : pairs) {
if (((Collection<V>) entry.getValue()).contains(value)) {
return true;
}
@@ -247,7 +247,7 @@ public class MultiValueMap<K, V> extends
*/
@Override
@SuppressWarnings("unchecked")
- public Object put(K key, Object value) {
+ public Object put(final K key, final Object value) {
boolean result = false;
Collection<V> coll = getCollection(key);
if (coll == null) {
@@ -277,13 +277,13 @@ public class MultiValueMap<K, V> extends
*/
@Override
@SuppressWarnings("unchecked")
- public void putAll(Map<? extends K, ?> map) {
+ public void putAll(final Map<? extends K, ?> map) {
if (map instanceof MultiMap) {
- for (Map.Entry<? extends K, Object> entry : ((MultiMap<? extends K, V>) map).entrySet()) {
+ for (final Map.Entry<? extends K, Object> entry : ((MultiMap<? extends K, V>) map).entrySet()) {
putAll(entry.getKey(), (Collection<V>) entry.getValue());
}
} else {
- for (Map.Entry<? extends K, ?> entry : map.entrySet()) {
+ for (final Map.Entry<? extends K, ?> entry : map.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
@@ -299,7 +299,7 @@ public class MultiValueMap<K, V> extends
@Override
@SuppressWarnings("unchecked")
public Collection<Object> values() {
- Collection<V> vs = valuesView;
+ final Collection<V> vs = valuesView;
return (Collection<Object>) (vs != null ? vs : (valuesView = new Values()));
}
@@ -309,8 +309,8 @@ public class MultiValueMap<K, V> extends
* @param value the value to search for
* @return true if the map contains the value
*/
- public boolean containsValue(Object key, Object value) {
- Collection<V> coll = getCollection(key);
+ public boolean containsValue(final Object key, final Object value) {
+ final Collection<V> coll = getCollection(key);
if (coll == null) {
return false;
}
@@ -325,7 +325,7 @@ public class MultiValueMap<K, V> extends
* @return the collection mapped to the key, null if no mapping
*/
@SuppressWarnings("unchecked")
- public Collection<V> getCollection(Object key) {
+ public Collection<V> getCollection(final Object key) {
return (Collection<V>) decorated().get(key);
}
@@ -335,8 +335,8 @@ public class MultiValueMap<K, V> extends
* @param key the key to get size for
* @return the size of the collection at the key, zero if key not in map
*/
- public int size(Object key) {
- Collection<V> coll = getCollection(key);
+ public int size(final Object key) {
+ final Collection<V> coll = getCollection(key);
if (coll == null) {
return 0;
}
@@ -351,7 +351,7 @@ public class MultiValueMap<K, V> extends
* @param values the values to add to the collection at the key, null ignored
* @return true if this map changed
*/
- public boolean putAll(K key, Collection<V> values) {
+ public boolean putAll(final K key, final Collection<V> values) {
if (values == null || values.size() == 0) {
return false;
}
@@ -377,7 +377,7 @@ public class MultiValueMap<K, V> extends
* @param key the key to get an iterator for
* @return the iterator of the collection at the key, empty iterator if key not in map
*/
- public Iterator<V> iterator(Object key) {
+ public Iterator<V> iterator(final Object key) {
if (!containsKey(key)) {
return EmptyIterator.<V>emptyIterator();
}
@@ -391,7 +391,7 @@ public class MultiValueMap<K, V> extends
*/
public int totalSize() {
int total = 0;
- for (Object v : decorated().values()) {
+ for (final Object v : decorated().values()) {
total += CollectionUtils.size(v);
}
return total;
@@ -407,7 +407,7 @@ public class MultiValueMap<K, V> extends
* @param size the collection size that is about to be added
* @return the new collection
*/
- protected Collection<V> createCollection(int size) {
+ protected Collection<V> createCollection(final int size) {
return collectionFactory.create();
}
@@ -419,7 +419,7 @@ public class MultiValueMap<K, V> extends
@Override
public Iterator<V> iterator() {
final IteratorChain<V> chain = new IteratorChain<V>();
- for (K k : keySet()) {
+ for (final K k : keySet()) {
chain.addIterator(new ValuesIterator(k));
}
return chain;
@@ -444,7 +444,7 @@ public class MultiValueMap<K, V> extends
private final Collection<V> values;
private final Iterator<V> iterator;
- public ValuesIterator(Object key) {
+ public ValuesIterator(final Object key) {
this.key = key;
this.values = getCollection(key);
this.iterator = values.iterator();
@@ -476,14 +476,14 @@ public class MultiValueMap<K, V> extends
private final Class<T> clazz;
- public ReflectionFactory(Class<T> clazz) {
+ public ReflectionFactory(final Class<T> clazz) {
this.clazz = clazz;
}
public T create() {
try {
return clazz.newInstance();
- } catch (Exception ex) {
+ } catch (final Exception ex) {
throw new FunctorException("Cannot instantiate class: " + clazz, ex);
}
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PassiveExpiringMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PassiveExpiringMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PassiveExpiringMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PassiveExpiringMap.java Mon Jan 7 17:15:14 2013
@@ -101,7 +101,7 @@ public class PassiveExpiringMap<K, V>
* results in entries that NEVER expire. A zero value results in
* entries that ALWAYS expire.
*/
- public ConstantTimeToLiveExpirationPolicy(long timeToLiveMillis) {
+ public ConstantTimeToLiveExpirationPolicy(final long timeToLiveMillis) {
super();
this.timeToLiveMillis = timeToLiveMillis;
}
@@ -118,8 +118,8 @@ public class PassiveExpiringMap<K, V>
* parameter, must not be null.
* @throws IllegalArgumentException if the time unit is null.
*/
- public ConstantTimeToLiveExpirationPolicy(long timeToLive,
- TimeUnit timeUnit) {
+ public ConstantTimeToLiveExpirationPolicy(final long timeToLive,
+ final TimeUnit timeUnit) {
this(validateAndConvertToMillis(timeToLive, TimeUnit.MILLISECONDS));
}
@@ -133,10 +133,10 @@ public class PassiveExpiringMap<K, V>
* {@link System#currentTimeMillis()} is returned. Otherwise, -1
* is returned indicating the entry never expires.
*/
- public long expirationTime(K key, V value) {
+ public long expirationTime(final K key, final V value) {
if (timeToLiveMillis >= 0L) {
// avoid numerical overflow
- long now = System.currentTimeMillis();
+ final long now = System.currentTimeMillis();
if (now > Long.MAX_VALUE - timeToLiveMillis) {
// expiration would be greater than Long.MAX_VALUE
// never expire
@@ -190,8 +190,8 @@ public class PassiveExpiringMap<K, V>
* parameter, must not be null.
* @throws IllegalArgumentException if the time unit is null.
*/
- private static long validateAndConvertToMillis(long timeToLive,
- TimeUnit timeUnit) {
+ private static long validateAndConvertToMillis(final long timeToLive,
+ final TimeUnit timeUnit) {
if (timeUnit == null) {
throw new IllegalArgumentException("Time unit must not be null");
}
@@ -219,7 +219,7 @@ public class PassiveExpiringMap<K, V>
* @param expiringPolicy the policy used to determine expiration times of
* entries as they are added.
*/
- public PassiveExpiringMap(ExpirationPolicy<K, V> expiringPolicy) {
+ public PassiveExpiringMap(final ExpirationPolicy<K, V> expiringPolicy) {
this(expiringPolicy, new HashMap<K, V>());
}
@@ -234,8 +234,8 @@ public class PassiveExpiringMap<K, V>
* @param map the map to decorate, must not be null.
* @throws IllegalArgumentException if the map is null.
*/
- public PassiveExpiringMap(ExpirationPolicy<K, V> expiringPolicy,
- Map<K, V> map) {
+ public PassiveExpiringMap(final ExpirationPolicy<K, V> expiringPolicy,
+ final Map<K, V> map) {
super(map);
if (expiringPolicy == null) {
throw new IllegalArgumentException("Policy must not be null.");
@@ -253,7 +253,7 @@ public class PassiveExpiringMap<K, V>
* entries that NEVER expire. A zero value results in entries that
* ALWAYS expire.
*/
- public PassiveExpiringMap(long timeToLiveMillis) {
+ public PassiveExpiringMap(final long timeToLiveMillis) {
this(new ConstantTimeToLiveExpirationPolicy<K, V>(timeToLiveMillis),
new HashMap<K, V>());
}
@@ -272,7 +272,7 @@ public class PassiveExpiringMap<K, V>
* @param map the map to decorate, must not be null.
* @throws IllegalArgumentException if the map is null.
*/
- public PassiveExpiringMap(long timeToLiveMillis, Map<K, V> map) {
+ public PassiveExpiringMap(final long timeToLiveMillis, final Map<K, V> map) {
this(new ConstantTimeToLiveExpirationPolicy<K, V>(timeToLiveMillis),
map);
}
@@ -289,7 +289,7 @@ public class PassiveExpiringMap<K, V>
* parameter, must not be null.
* @throws IllegalArgumentException if the time unit is null.
*/
- public PassiveExpiringMap(long timeToLive, TimeUnit timeUnit) {
+ public PassiveExpiringMap(final long timeToLive, final TimeUnit timeUnit) {
this(validateAndConvertToMillis(timeToLive, timeUnit));
}
@@ -310,7 +310,7 @@ public class PassiveExpiringMap<K, V>
* @param map the map to decorate, must not be null.
* @throws IllegalArgumentException if the map is null.
*/
- public PassiveExpiringMap(long timeToLive, TimeUnit timeUnit, Map<K, V> map) {
+ public PassiveExpiringMap(final long timeToLive, final TimeUnit timeUnit, final Map<K, V> map) {
this(validateAndConvertToMillis(timeToLive, timeUnit), map);
}
@@ -322,7 +322,7 @@ public class PassiveExpiringMap<K, V>
* @param map the map to decorate, must not be null.
* @throws IllegalArgumentException if the map is null.
*/
- public PassiveExpiringMap(Map<K, V> map) {
+ public PassiveExpiringMap(final Map<K, V> map) {
this(-1L, map);
}
@@ -342,7 +342,7 @@ public class PassiveExpiringMap<K, V>
* {@inheritDoc}
*/
@Override
- public boolean containsKey(Object key) {
+ public boolean containsKey(final Object key) {
removeIfExpired(key, now());
return super.containsKey(key);
}
@@ -353,7 +353,7 @@ public class PassiveExpiringMap<K, V>
* {@inheritDoc}
*/
@Override
- public boolean containsValue(Object value) {
+ public boolean containsValue(final Object value) {
removeAllExpired(now());
return super.containsValue(value);
}
@@ -373,7 +373,7 @@ public class PassiveExpiringMap<K, V>
* {@inheritDoc}
*/
@Override
- public V get(Object key) {
+ public V get(final Object key) {
removeIfExpired(key, now());
return super.get(key);
}
@@ -399,9 +399,9 @@ public class PassiveExpiringMap<K, V>
* and <code>expirationTimeObject</code> < <code>now</code>.
* <code>false</code> otherwise.
*/
- private boolean isExpired(long now, Long expirationTimeObject) {
+ private boolean isExpired(final long now, final Long expirationTimeObject) {
if (expirationTimeObject != null) {
- long expirationTime = expirationTimeObject.longValue();
+ final long expirationTime = expirationTimeObject.longValue();
return expirationTime >= 0 && now >= expirationTime;
}
return false;
@@ -425,7 +425,7 @@ public class PassiveExpiringMap<K, V>
}
@Override
- public V put(K key, V value) {
+ public V put(final K key, final V value) {
return put(key, value, now());
}
@@ -433,17 +433,17 @@ public class PassiveExpiringMap<K, V>
* Add the given key-value pair to this map as well as recording the entry's expiration time based on
* the current time in milliseconds, <code>now</code> and this map's {@link #expiringPolicy}.
*/
- private V put(K key, V value, long now) {
+ private V put(final K key, final V value, final long now) {
// record expiration time of new entry
- long expirationTime = expiringPolicy.expirationTime(key, value);
+ final long expirationTime = expiringPolicy.expirationTime(key, value);
expirationMap.put(key, Long.valueOf(expirationTime));
return super.put(key, value);
}
@Override
- public void putAll(Map<? extends K, ? extends V> mapToCopy) {
- for (Map.Entry<? extends K, ? extends V> entry : mapToCopy.entrySet()) {
+ public void putAll(final Map<? extends K, ? extends V> mapToCopy) {
+ for (final Map.Entry<? extends K, ? extends V> entry : mapToCopy.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
@@ -454,7 +454,7 @@ public class PassiveExpiringMap<K, V>
* {@inheritDoc}
*/
@Override
- public V remove(Object key) {
+ public V remove(final Object key) {
expirationMap.remove(key);
return super.remove(key);
}
@@ -466,11 +466,11 @@ public class PassiveExpiringMap<K, V>
*
* @see #isExpired(long, Long)
*/
- private void removeAllExpired(long now) {
- Iterator<Map.Entry<Object, Long>> iter = expirationMap.entrySet()
+ private void removeAllExpired(final long now) {
+ final Iterator<Map.Entry<Object, Long>> iter = expirationMap.entrySet()
.iterator();
while (iter.hasNext()) {
- Map.Entry<Object, Long> expirationEntry = iter.next();
+ final Map.Entry<Object, Long> expirationEntry = iter.next();
if (isExpired(now, expirationEntry.getValue())) {
// remove entry from collection
super.remove(expirationEntry.getKey());
@@ -485,8 +485,8 @@ public class PassiveExpiringMap<K, V>
* less than <code>now</code>. If the entry has a negative expiration time,
* the entry is never removed.
*/
- private void removeIfExpired(Object key, long now) {
- Long expirationTimeObject = expirationMap.get(key);
+ private void removeIfExpired(final Object key, final long now) {
+ final Long expirationTimeObject = expirationMap.get(key);
if (isExpired(now, expirationTimeObject)) {
remove(key);
}
@@ -511,7 +511,7 @@ public class PassiveExpiringMap<K, V>
*/
@SuppressWarnings("unchecked")
// (1) should only fail if input stream is incorrect
- private void readObject(ObjectInputStream in)
+ private void readObject(final ObjectInputStream in)
throws IOException, ClassNotFoundException {
in.defaultReadObject();
map = (Map<K, V>) in.readObject(); // (1)
@@ -523,7 +523,7 @@ public class PassiveExpiringMap<K, V>
* @param out the output stream
* @throws IOException
*/
- private void writeObject(ObjectOutputStream out)
+ private void writeObject(final ObjectOutputStream out)
throws IOException {
out.defaultWriteObject();
out.writeObject(map);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedMap.java Mon Jan 7 17:15:14 2013
@@ -74,9 +74,9 @@ public class PredicatedMap<K, V>
* @return a new predicated map
* @throws IllegalArgumentException if the map is null
*/
- public static <K, V> PredicatedMap<K, V> predicatedMap(Map<K, V> map,
- Predicate<? super K> keyPredicate,
- Predicate<? super V> valuePredicate) {
+ public static <K, V> PredicatedMap<K, V> predicatedMap(final Map<K, V> map,
+ final Predicate<? super K> keyPredicate,
+ final Predicate<? super V> valuePredicate) {
return new PredicatedMap<K, V>(map, keyPredicate, valuePredicate);
}
@@ -89,14 +89,14 @@ public class PredicatedMap<K, V>
* @param valuePredicate the predicate to validate to values, null means no check
* @throws IllegalArgumentException if the map is null
*/
- protected PredicatedMap(Map<K, V> map, Predicate<? super K> keyPredicate, Predicate<? super V> valuePredicate) {
+ protected PredicatedMap(final Map<K, V> map, final Predicate<? super K> keyPredicate, final Predicate<? super V> valuePredicate) {
super(map);
this.keyPredicate = keyPredicate;
this.valuePredicate = valuePredicate;
- Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+ final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
while (it.hasNext()) {
- Map.Entry<K, V> entry = it.next();
+ final Map.Entry<K, V> entry = it.next();
validate(entry.getKey(), entry.getValue());
}
}
@@ -109,7 +109,7 @@ public class PredicatedMap<K, V>
* @throws IOException
* @since 3.1
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(map);
}
@@ -123,7 +123,7 @@ public class PredicatedMap<K, 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)
}
@@ -136,7 +136,7 @@ public class PredicatedMap<K, V>
* @param value the value to validate
* @throws IllegalArgumentException if invalid
*/
- protected void validate(K key, V value) {
+ protected void validate(final K key, final V value) {
if (keyPredicate != null && keyPredicate.evaluate(key) == false) {
throw new IllegalArgumentException("Cannot add key - Predicate rejected it");
}
@@ -154,7 +154,7 @@ public class PredicatedMap<K, V>
* @since 3.1
*/
@Override
- protected V checkSetValue(V value) {
+ protected V checkSetValue(final V value) {
if (valuePredicate.evaluate(value) == false) {
throw new IllegalArgumentException("Cannot set value - Predicate rejected it");
}
@@ -174,14 +174,14 @@ public class PredicatedMap<K, V>
//-----------------------------------------------------------------------
@Override
- public V put(K key, V value) {
+ public V put(final K key, final V value) {
validate(key, value);
return map.put(key, value);
}
@Override
- public void putAll(Map<? extends K, ? extends V> mapToCopy) {
- for (Map.Entry<? extends K, ? extends V> entry : mapToCopy.entrySet()) {
+ public void putAll(final Map<? extends K, ? extends V> mapToCopy) {
+ for (final Map.Entry<? extends K, ? extends V> entry : mapToCopy.entrySet()) {
validate(entry.getKey(), entry.getValue());
}
super.putAll(mapToCopy);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java Mon Jan 7 17:15:14 2013
@@ -62,8 +62,8 @@ public class PredicatedSortedMap<K, V> e
* @return a new predicated sorted map
* @throws IllegalArgumentException if the map is null
*/
- public static <K, V> PredicatedSortedMap<K, V> predicatedSortedMap(SortedMap<K, V> map,
- Predicate<? super K> keyPredicate, Predicate<? super V> valuePredicate) {
+ public static <K, V> PredicatedSortedMap<K, V> predicatedSortedMap(final SortedMap<K, V> map,
+ final Predicate<? super K> keyPredicate, final Predicate<? super V> valuePredicate) {
return new PredicatedSortedMap<K, V>(map, keyPredicate, valuePredicate);
}
@@ -76,8 +76,8 @@ public class PredicatedSortedMap<K, V> e
* @param valuePredicate the predicate to validate to values, null means no check
* @throws IllegalArgumentException if the map is null
*/
- protected PredicatedSortedMap(SortedMap<K, V> map, Predicate<? super K> keyPredicate,
- Predicate<? super V> valuePredicate) {
+ protected PredicatedSortedMap(final SortedMap<K, V> map, final Predicate<? super K> keyPredicate,
+ final Predicate<? super V> valuePredicate) {
super(map, keyPredicate, valuePredicate);
}
@@ -104,18 +104,18 @@ public class PredicatedSortedMap<K, V> e
return getSortedMap().comparator();
}
- public SortedMap<K, V> subMap(K fromKey, K toKey) {
- SortedMap<K, V> map = getSortedMap().subMap(fromKey, toKey);
+ public SortedMap<K, V> subMap(final K fromKey, final K toKey) {
+ final SortedMap<K, V> map = getSortedMap().subMap(fromKey, toKey);
return new PredicatedSortedMap<K, V>(map, keyPredicate, valuePredicate);
}
- public SortedMap<K, V> headMap(K toKey) {
- SortedMap<K, V> map = getSortedMap().headMap(toKey);
+ public SortedMap<K, V> headMap(final K toKey) {
+ final SortedMap<K, V> map = getSortedMap().headMap(toKey);
return new PredicatedSortedMap<K, V>(map, keyPredicate, valuePredicate);
}
- public SortedMap<K, V> tailMap(K fromKey) {
- SortedMap<K, V> map = getSortedMap().tailMap(fromKey);
+ public SortedMap<K, V> tailMap(final K fromKey) {
+ final SortedMap<K, V> map = getSortedMap().tailMap(fromKey);
return new PredicatedSortedMap<K, V>(map, keyPredicate, valuePredicate);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ReferenceIdentityMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ReferenceIdentityMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ReferenceIdentityMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ReferenceIdentityMap.java Mon Jan 7 17:15:14 2013
@@ -95,7 +95,7 @@ public class ReferenceIdentityMap<K, V>
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
*/
- public ReferenceIdentityMap(ReferenceStrength keyType, ReferenceStrength valueType) {
+ public ReferenceIdentityMap(final ReferenceStrength keyType, final ReferenceStrength valueType) {
super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
}
@@ -114,8 +114,8 @@ public class ReferenceIdentityMap<K, V>
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
*/
- public ReferenceIdentityMap(ReferenceStrength keyType, ReferenceStrength valueType,
- boolean purgeValues) {
+ public ReferenceIdentityMap(final ReferenceStrength keyType, final ReferenceStrength valueType,
+ final boolean purgeValues) {
super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, purgeValues);
}
@@ -134,8 +134,8 @@ public class ReferenceIdentityMap<K, V>
* @param capacity the initial capacity for the map
* @param loadFactor the load factor for the map
*/
- public ReferenceIdentityMap(ReferenceStrength keyType, ReferenceStrength valueType,
- int capacity, float loadFactor) {
+ public ReferenceIdentityMap(final ReferenceStrength keyType, final ReferenceStrength valueType,
+ final int capacity, final float loadFactor) {
super(keyType, valueType, capacity, loadFactor, false);
}
@@ -156,8 +156,8 @@ public class ReferenceIdentityMap<K, V>
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
*/
- public ReferenceIdentityMap(ReferenceStrength keyType, ReferenceStrength valueType,
- int capacity, float loadFactor, boolean purgeValues) {
+ public ReferenceIdentityMap(final ReferenceStrength keyType, final ReferenceStrength valueType,
+ final int capacity, final float loadFactor, final boolean purgeValues) {
super(keyType, valueType, capacity, loadFactor, purgeValues);
}
@@ -171,7 +171,7 @@ public class ReferenceIdentityMap<K, V>
* @return the hash code
*/
@Override
- protected int hash(Object key) {
+ protected int hash(final Object key) {
return System.identityHashCode(key);
}
@@ -185,7 +185,7 @@ public class ReferenceIdentityMap<K, V>
* @return the hash code, as per the MapEntry specification
*/
@Override
- protected int hashEntry(Object key, Object value) {
+ protected int hashEntry(final Object key, final Object value) {
return System.identityHashCode(key) ^
System.identityHashCode(value);
}
@@ -201,7 +201,7 @@ public class ReferenceIdentityMap<K, V>
* @return true if equal by identity
*/
@Override
- protected boolean isEqualKey(Object key1, Object key2) {
+ protected boolean isEqualKey(final Object key1, Object key2) {
key2 = keyType == ReferenceStrength.HARD ? key2 : ((Reference<?>) key2).get();
return key1 == key2;
}
@@ -216,7 +216,7 @@ public class ReferenceIdentityMap<K, V>
* @return true if equal by identity
*/
@Override
- protected boolean isEqualValue(Object value1, Object value2) {
+ protected boolean isEqualValue(final Object value1, final Object value2) {
return value1 == value2;
}
@@ -224,7 +224,7 @@ public class ReferenceIdentityMap<K, V>
/**
* Write the map out using a custom routine.
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
doWriteObject(out);
}
@@ -232,7 +232,7 @@ public class ReferenceIdentityMap<K, V>
/**
* Read the map in using a custom routine.
*/
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
doReadObject(in);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ReferenceMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ReferenceMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ReferenceMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/ReferenceMap.java Mon Jan 7 17:15:14 2013
@@ -97,7 +97,7 @@ public class ReferenceMap<K, V> extends
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
*/
- public ReferenceMap(ReferenceStrength keyType, ReferenceStrength valueType) {
+ public ReferenceMap(final ReferenceStrength keyType, final ReferenceStrength valueType) {
super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false);
}
@@ -116,7 +116,7 @@ public class ReferenceMap<K, V> extends
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
*/
- public ReferenceMap(ReferenceStrength keyType, ReferenceStrength valueType, boolean purgeValues) {
+ public ReferenceMap(final ReferenceStrength keyType, final ReferenceStrength valueType, final boolean purgeValues) {
super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, purgeValues);
}
@@ -136,8 +136,8 @@ public class ReferenceMap<K, V> extends
* @param capacity the initial capacity for the map
* @param loadFactor the load factor for the map
*/
- public ReferenceMap(ReferenceStrength keyType, ReferenceStrength valueType, int capacity,
- float loadFactor) {
+ public ReferenceMap(final ReferenceStrength keyType, final ReferenceStrength valueType, final int capacity,
+ final float loadFactor) {
super(keyType, valueType, capacity, loadFactor, false);
}
@@ -159,8 +159,8 @@ public class ReferenceMap<K, V> extends
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
*/
- public ReferenceMap(ReferenceStrength keyType, ReferenceStrength valueType, int capacity,
- float loadFactor, boolean purgeValues) {
+ public ReferenceMap(final ReferenceStrength keyType, final ReferenceStrength valueType, final int capacity,
+ final float loadFactor, final boolean purgeValues) {
super(keyType, valueType, capacity, loadFactor, purgeValues);
}
@@ -168,7 +168,7 @@ public class ReferenceMap<K, V> extends
/**
* Write the map out using a custom routine.
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
doWriteObject(out);
}
@@ -176,7 +176,7 @@ public class ReferenceMap<K, V> extends
/**
* Read the map in using a custom routine.
*/
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
doReadObject(in);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/SingletonMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/SingletonMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/SingletonMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/SingletonMap.java Mon Jan 7 17:15:14 2013
@@ -81,7 +81,7 @@ public class SingletonMap<K, V>
* @param key the key to use
* @param value the value to use
*/
- public SingletonMap(K key, V value) {
+ public SingletonMap(final K key, final V value) {
super();
this.key = key;
this.value = value;
@@ -92,7 +92,7 @@ public class SingletonMap<K, V>
*
* @param keyValue the key value pair to use
*/
- public SingletonMap(KeyValue<K, V> keyValue) {
+ public SingletonMap(final KeyValue<K, V> keyValue) {
super();
this.key = keyValue.getKey();
this.value = keyValue.getValue();
@@ -103,7 +103,7 @@ public class SingletonMap<K, V>
*
* @param mapEntry the mapEntry to use
*/
- public SingletonMap(Map.Entry<K, V> mapEntry) {
+ public SingletonMap(final Map.Entry<K, V> mapEntry) {
super();
this.key = mapEntry.getKey();
this.value = mapEntry.getValue();
@@ -116,12 +116,12 @@ public class SingletonMap<K, V>
* @throws NullPointerException if the map is null
* @throws IllegalArgumentException if the size is not 1
*/
- public SingletonMap(Map<K, V> map) {
+ public SingletonMap(final Map<K, V> map) {
super();
if (map.size() != 1) {
throw new IllegalArgumentException("The map size must be 1");
}
- Map.Entry<K, V> entry = map.entrySet().iterator().next();
+ final Map.Entry<K, V> entry = map.entrySet().iterator().next();
this.key = entry.getKey();
this.value = entry.getValue();
}
@@ -152,8 +152,8 @@ public class SingletonMap<K, V>
* @param value the new value to set
* @return the old value
*/
- public V setValue(V value) {
- V old = this.value;
+ public V setValue(final V value) {
+ final V old = this.value;
this.value = value;
return old;
}
@@ -186,7 +186,7 @@ public class SingletonMap<K, V>
* @param key the key
* @return the mapped value, null if no match
*/
- public V get(Object key) {
+ public V get(final Object key) {
if (isEqualKey(key)) {
return value;
}
@@ -218,7 +218,7 @@ public class SingletonMap<K, V>
* @param key the key to search for
* @return true if the map contains the key
*/
- public boolean containsKey(Object key) {
+ public boolean containsKey(final Object key) {
return isEqualKey(key);
}
@@ -228,7 +228,7 @@ public class SingletonMap<K, V>
* @param value the value to search for
* @return true if the map contains the key
*/
- public boolean containsValue(Object value) {
+ public boolean containsValue(final Object value) {
return isEqualValue(value);
}
@@ -244,7 +244,7 @@ public class SingletonMap<K, V>
* @return the value previously mapped to this key, null if none
* @throws IllegalArgumentException if the key does not match
*/
- public V put(K key, V value) {
+ public V put(final K key, final V value) {
if (isEqualKey(key)) {
return setValue(value);
}
@@ -262,13 +262,13 @@ public class SingletonMap<K, V>
* @throws NullPointerException if the map is null
* @throws IllegalArgumentException if the key does not match
*/
- public void putAll(Map<? extends K, ? extends V> map) {
+ public void putAll(final Map<? extends K, ? extends V> map) {
switch (map.size()) {
case 0:
return;
case 1:
- Map.Entry<? extends K, ? extends V> entry = map.entrySet().iterator().next();
+ final Map.Entry<? extends K, ? extends V> entry = map.entrySet().iterator().next();
put(entry.getKey(), entry.getValue());
return;
@@ -284,7 +284,7 @@ public class SingletonMap<K, V>
* @return the value mapped to the removed key, null if key not in map
* @throws UnsupportedOperationException always
*/
- public V remove(Object key) {
+ public V remove(final Object key) {
throw new UnsupportedOperationException();
}
@@ -304,7 +304,7 @@ public class SingletonMap<K, V>
* @return the entrySet view
*/
public Set<Map.Entry<K, V>> entrySet() {
- Map.Entry<K, V> entry = new TiedMapEntry<K, V>(this, getKey());
+ final Map.Entry<K, V> entry = new TiedMapEntry<K, V>(this, getKey());
return Collections.singleton(entry);
}
@@ -361,7 +361,7 @@ public class SingletonMap<K, V>
* @param key the next key
* @return null always
*/
- public K nextKey(K key) {
+ public K nextKey(final K key) {
return null;
}
@@ -371,7 +371,7 @@ public class SingletonMap<K, V>
* @param key the next key
* @return null always
*/
- public K previousKey(K key) {
+ public K previousKey(final K key) {
return null;
}
@@ -382,7 +382,7 @@ public class SingletonMap<K, V>
* @param key the key to compare
* @return true if equal
*/
- protected boolean isEqualKey(Object key) {
+ protected boolean isEqualKey(final Object key) {
return key == null ? getKey() == null : key.equals(getKey());
}
@@ -392,7 +392,7 @@ public class SingletonMap<K, V>
* @param value the value to compare
* @return true if equal
*/
- protected boolean isEqualValue(Object value) {
+ protected boolean isEqualValue(final Object value) {
return value == null ? getValue() == null : value.equals(getValue());
}
@@ -405,7 +405,7 @@ public class SingletonMap<K, V>
private boolean hasNext = true;
private boolean canGetSet = false;
- SingletonMapIterator(SingletonMap<K, V> parent) {
+ SingletonMapIterator(final SingletonMap<K, V> parent) {
super();
this.parent = parent;
}
@@ -453,7 +453,7 @@ public class SingletonMap<K, V>
return parent.getValue();
}
- public V setValue(V value) {
+ public V setValue(final V value) {
if (canGetSet == false) {
throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
}
@@ -481,7 +481,7 @@ public class SingletonMap<K, V>
private static final long serialVersionUID = -3689524741863047872L;
private final SingletonMap<?, V> parent;
- SingletonValues(SingletonMap<?, V> parent) {
+ SingletonValues(final SingletonMap<?, V> parent) {
super();
this.parent = parent;
}
@@ -495,7 +495,7 @@ public class SingletonMap<K, V>
return false;
}
@Override
- public boolean contains(Object object) {
+ public boolean contains(final Object object) {
return parent.containsValue(object);
}
@Override
@@ -519,7 +519,7 @@ public class SingletonMap<K, V>
public SingletonMap<K, V> clone() {
try {
return (SingletonMap<K, V>) super.clone();
- } catch (CloneNotSupportedException ex) {
+ } catch (final CloneNotSupportedException ex) {
throw new InternalError();
}
}
@@ -531,18 +531,18 @@ public class SingletonMap<K, V>
* @return true if equal
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Map == false) {
return false;
}
- Map<?,?> other = (Map<?,?>) obj;
+ final Map<?,?> other = (Map<?,?>) obj;
if (other.size() != 1) {
return false;
}
- Map.Entry<?,?> entry = other.entrySet().iterator().next();
+ final Map.Entry<?,?> entry = other.entrySet().iterator().next();
return isEqualKey(entry.getKey()) && isEqualValue(entry.getValue());
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/StaticBucketMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/StaticBucketMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/StaticBucketMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/StaticBucketMap.java Mon Jan 7 17:15:14 2013
@@ -120,7 +120,7 @@ public final class StaticBucketMap<K, V>
* @param numBuckets the number of buckets for this map
*/
@SuppressWarnings("unchecked")
- public StaticBucketMap(int numBuckets) {
+ public StaticBucketMap(final int numBuckets) {
int size = Math.max(17, numBuckets);
// Ensure that bucketSize is never a power of 2 (to ensure maximal distribution)
@@ -150,7 +150,7 @@ public final class StaticBucketMap<K, V>
* the number of buckets.
* </p>
*/
- private final int getHash(Object key) {
+ private final int getHash(final Object key) {
if (key == null) {
return 0;
}
@@ -198,7 +198,7 @@ public final class StaticBucketMap<K, V>
* @return the associated value
*/
public V get(final Object key) {
- int hash = getHash(key);
+ final int hash = getHash(key);
synchronized (locks[hash]) {
Node<K, V> n = buckets[hash];
@@ -221,7 +221,7 @@ public final class StaticBucketMap<K, V>
* @return true if found
*/
public boolean containsKey(final Object key) {
- int hash = getHash(key);
+ final int hash = getHash(key);
synchronized (locks[hash]) {
Node<K, V> n = buckets[hash];
@@ -269,7 +269,7 @@ public final class StaticBucketMap<K, V>
* @return the previous mapping for the key
*/
public V put(final K key, final V value) {
- int hash = getHash(key);
+ final int hash = getHash(key);
synchronized (locks[hash]) {
Node<K, V> n = buckets[hash];
@@ -290,7 +290,7 @@ public final class StaticBucketMap<K, V>
n = next;
if (n.key == key || (n.key != null && n.key.equals(key))) {
- V returnVal = n.value;
+ final V returnVal = n.value;
n.value = value;
return returnVal;
}
@@ -298,7 +298,7 @@ public final class StaticBucketMap<K, V>
// The key was not found in the current list of nodes, add it to the end
// in a new node.
- Node<K, V> newNode = new Node<K, V>();
+ final Node<K, V> newNode = new Node<K, V>();
newNode.key = key;
newNode.value = value;
n.next = newNode;
@@ -313,8 +313,8 @@ public final class StaticBucketMap<K, V>
* @param key the key to remove
* @return the previous value at this key
*/
- public V remove(Object key) {
- int hash = getHash(key);
+ public V remove(final Object key) {
+ final int hash = getHash(key);
synchronized (locks[hash]) {
Node<K, V> n = buckets[hash];
@@ -376,8 +376,8 @@ public final class StaticBucketMap<K, V>
*
* @param map the map of entries to add
*/
- public void putAll(Map<? extends K, ? extends V> map) {
- for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
+ public void putAll(final Map<? extends K, ? extends V> map) {
+ for (final Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
@@ -387,7 +387,7 @@ public final class StaticBucketMap<K, V>
*/
public void clear() {
for (int i = 0; i < buckets.length; i++) {
- Lock lock = locks[i];
+ final Lock lock = locks[i];
synchronized (lock) {
buckets[i] = null;
lock.size = 0;
@@ -402,14 +402,14 @@ public final class StaticBucketMap<K, V>
* @return true if equal
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Map<?, ?> == false) {
return false;
}
- Map<?, ?> other = (Map<?, ?>) obj;
+ final Map<?, ?> other = (Map<?, ?>) obj;
return entrySet().equals(other.entrySet());
}
@@ -459,7 +459,7 @@ public final class StaticBucketMap<K, V>
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
@@ -467,14 +467,14 @@ public final class StaticBucketMap<K, V>
return false;
}
- Map.Entry<?, ?> e2 = (Map.Entry<?, ?>) obj;
+ final Map.Entry<?, ?> e2 = (Map.Entry<?, ?>) obj;
return (
(key == null ? e2.getKey() == null : key.equals(e2.getKey())) &&
(value == null ? e2.getValue() == null : value.equals(e2.getValue())));
}
- public V setValue(V obj) {
- V retVal = value;
+ public V setValue(final V obj) {
+ final V retVal = value;
value = obj;
return retVal;
}
@@ -489,7 +489,7 @@ public final class StaticBucketMap<K, V>
//-----------------------------------------------------------------------
private class BaseIterator {
- private ArrayList<Map.Entry<K, V>> current = new ArrayList<Map.Entry<K,V>>();
+ private final ArrayList<Map.Entry<K, V>> current = new ArrayList<Map.Entry<K,V>>();
private int bucket;
private Map.Entry<K, V> last;
@@ -572,9 +572,9 @@ public final class StaticBucketMap<K, V>
}
@Override
- public boolean contains(Object obj) {
- Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
- int hash = getHash(entry.getKey());
+ public boolean contains(final Object obj) {
+ final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
+ final int hash = getHash(entry.getKey());
synchronized (locks[hash]) {
for (Node<K, V> n = buckets[hash]; n != null; n = n.next) {
if (n.equals(entry)) {
@@ -586,12 +586,12 @@ public final class StaticBucketMap<K, V>
}
@Override
- public boolean remove(Object obj) {
+ public boolean remove(final Object obj) {
if (obj instanceof Map.Entry<?, ?> == false) {
return false;
}
- Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
- int hash = getHash(entry.getKey());
+ final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
+ final int hash = getHash(entry.getKey());
synchronized (locks[hash]) {
for (Node<K, V> n = buckets[hash]; n != null; n = n.next) {
if (n.equals(entry)) {
@@ -623,16 +623,16 @@ public final class StaticBucketMap<K, V>
}
@Override
- public boolean contains(Object obj) {
+ public boolean contains(final Object obj) {
return StaticBucketMap.this.containsKey(obj);
}
@Override
- public boolean remove(Object obj) {
- int hash = getHash(obj);
+ public boolean remove(final Object obj) {
+ final int hash = getHash(obj);
synchronized (locks[hash]) {
for (Node<K, V> n = buckets[hash]; n != null; n = n.next) {
- Object k = n.getKey();
+ final Object k = n.getKey();
if ((k == obj) || ((k != null) && k.equals(obj))) {
StaticBucketMap.this.remove(k);
return true;
@@ -698,14 +698,14 @@ public final class StaticBucketMap<K, V>
*
* @param r the code to execute atomically
*/
- public void atomic(Runnable r) {
+ public void atomic(final Runnable r) {
if (r == null) {
throw new NullPointerException();
}
atomic(r, 0);
}
- private void atomic(Runnable r, int bucket) {
+ private void atomic(final Runnable r, final int bucket) {
if (bucket >= buckets.length) {
r.run();
return;
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedMap.java Mon Jan 7 17:15:14 2013
@@ -72,9 +72,9 @@ public class TransformedMap<K, V>
* @return a new transformed map
* @throws IllegalArgumentException if map is null
*/
- public static <K, V> TransformedMap<K, V> transformingMap(Map<K, V> map,
- Transformer<? super K, ? extends K> keyTransformer,
- Transformer<? super V, ? extends V> valueTransformer) {
+ public static <K, V> TransformedMap<K, V> transformingMap(final Map<K, V> map,
+ final Transformer<? super K, ? extends K> keyTransformer,
+ final Transformer<? super V, ? extends V> valueTransformer) {
return new TransformedMap<K, V>(map, keyTransformer, valueTransformer);
}
@@ -95,12 +95,12 @@ public class TransformedMap<K, V>
* @throws IllegalArgumentException if map is null
* @since 3.2
*/
- public static <K, V> TransformedMap<K, V> transformedMap(Map<K, V> map,
- Transformer<? super K, ? extends K> keyTransformer,
- Transformer<? super V, ? extends V> valueTransformer) {
- TransformedMap<K, V> decorated = new TransformedMap<K, V>(map, keyTransformer, valueTransformer);
+ public static <K, V> TransformedMap<K, V> transformedMap(final Map<K, V> map,
+ final Transformer<? super K, ? extends K> keyTransformer,
+ final Transformer<? super V, ? extends V> valueTransformer) {
+ final TransformedMap<K, V> decorated = new TransformedMap<K, V>(map, keyTransformer, valueTransformer);
if (map.size() > 0) {
- Map<K, V> transformed = decorated.transformMap(map);
+ final Map<K, V> transformed = decorated.transformMap(map);
decorated.clear();
decorated.decorated().putAll(transformed); // avoids double transformation
}
@@ -119,8 +119,8 @@ public class TransformedMap<K, V>
* @param valueTransformer the transformer to use for value conversion, null means no conversion
* @throws IllegalArgumentException if map is null
*/
- protected TransformedMap(Map<K, V> map, Transformer<? super K, ? extends K> keyTransformer,
- Transformer<? super V, ? extends V> valueTransformer) {
+ protected TransformedMap(final Map<K, V> map, final Transformer<? super K, ? extends K> keyTransformer,
+ final Transformer<? super V, ? extends V> valueTransformer) {
super(map);
this.keyTransformer = keyTransformer;
this.valueTransformer = valueTransformer;
@@ -134,7 +134,7 @@ public class TransformedMap<K, V>
* @throws IOException
* @since 3.1
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(map);
}
@@ -148,7 +148,7 @@ public class TransformedMap<K, 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)
}
@@ -162,7 +162,7 @@ public class TransformedMap<K, V>
* @param object the object to transform
* @return the transformed object
*/
- protected K transformKey(K object) {
+ protected K transformKey(final K object) {
if (keyTransformer == null) {
return object;
}
@@ -177,7 +177,7 @@ public class TransformedMap<K, V>
* @param object the object to transform
* @return the transformed object
*/
- protected V transformValue(V object) {
+ protected V transformValue(final V object) {
if (valueTransformer == null) {
return object;
}
@@ -193,13 +193,13 @@ public class TransformedMap<K, V>
* @return the transformed object
*/
@SuppressWarnings("unchecked")
- protected Map<K, V> transformMap(Map<? extends K, ? extends V> map) {
+ protected Map<K, V> transformMap(final Map<? extends K, ? extends V> 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 K, ? extends V> entry : map.entrySet()) {
+ for (final Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
result.put(transformKey(entry.getKey()), transformValue(entry.getValue()));
}
return result;
@@ -213,7 +213,7 @@ public class TransformedMap<K, V>
* @since 3.1
*/
@Override
- protected V checkSetValue(V value) {
+ protected V checkSetValue(final V value) {
return valueTransformer.transform(value);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java Mon Jan 7 17:15:14 2013
@@ -62,9 +62,9 @@ public class TransformedSortedMap<K, V>
* @return a new transformed sorted map
* @throws IllegalArgumentException if the map is null
*/
- public static <K, V> TransformedSortedMap<K, V> transformingSortedMap(SortedMap<K, V> map,
- Transformer<? super K, ? extends K> keyTransformer,
- Transformer<? super V, ? extends V> valueTransformer) {
+ public static <K, V> TransformedSortedMap<K, V> transformingSortedMap(final SortedMap<K, V> map,
+ final Transformer<? super K, ? extends K> keyTransformer,
+ final Transformer<? super V, ? extends V> valueTransformer) {
return new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
}
@@ -85,12 +85,12 @@ public class TransformedSortedMap<K, V>
* @throws IllegalArgumentException if map is null
* @since 3.2
*/
- public static <K, V> TransformedSortedMap<K, V> transformedSortedMap(SortedMap<K, V> map,
- Transformer<? super K, ? extends K> keyTransformer,
- Transformer<? super V, ? extends V> valueTransformer) {
- TransformedSortedMap<K, V> decorated = new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
+ public static <K, V> TransformedSortedMap<K, V> transformedSortedMap(final SortedMap<K, V> map,
+ final Transformer<? super K, ? extends K> keyTransformer,
+ final Transformer<? super V, ? extends V> valueTransformer) {
+ final TransformedSortedMap<K, V> decorated = new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
if (map.size() > 0) {
- Map<K, V> transformed = decorated.transformMap(map);
+ final Map<K, V> transformed = decorated.transformMap(map);
decorated.clear();
decorated.decorated().putAll(transformed); // avoids double transformation
}
@@ -109,9 +109,9 @@ public class TransformedSortedMap<K, V>
* @param valueTransformer the predicate to validate to values, null means no transformation
* @throws IllegalArgumentException if the map is null
*/
- protected TransformedSortedMap(SortedMap<K, V> map,
- Transformer<? super K, ? extends K> keyTransformer,
- Transformer<? super V, ? extends V> valueTransformer) {
+ protected TransformedSortedMap(final SortedMap<K, V> map,
+ final Transformer<? super K, ? extends K> keyTransformer,
+ final Transformer<? super V, ? extends V> valueTransformer) {
super(map, keyTransformer, valueTransformer);
}
@@ -138,18 +138,18 @@ public class TransformedSortedMap<K, V>
return getSortedMap().comparator();
}
- public SortedMap<K, V> subMap(K fromKey, K toKey) {
- SortedMap<K, V> map = getSortedMap().subMap(fromKey, toKey);
+ public SortedMap<K, V> subMap(final K fromKey, final K toKey) {
+ final SortedMap<K, V> map = getSortedMap().subMap(fromKey, toKey);
return new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
}
- public SortedMap<K, V> headMap(K toKey) {
- SortedMap<K, V> map = getSortedMap().headMap(toKey);
+ public SortedMap<K, V> headMap(final K toKey) {
+ final SortedMap<K, V> map = getSortedMap().headMap(toKey);
return new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
}
- public SortedMap<K, V> tailMap(K fromKey) {
- SortedMap<K, V> map = getSortedMap().tailMap(fromKey);
+ public SortedMap<K, V> tailMap(final K fromKey) {
+ final SortedMap<K, V> map = getSortedMap().tailMap(fromKey);
return new TransformedSortedMap<K, V>(map, keyTransformer, valueTransformer);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java Mon Jan 7 17:15:14 2013
@@ -50,7 +50,7 @@ public final class UnmodifiableEntrySet<
* @return a new unmodifiable entry set
* @throws IllegalArgumentException if set is null
*/
- public static <K, V> Set<Map.Entry<K, V>> unmodifiableEntrySet(Set<Map.Entry<K, V>> set) {
+ public static <K, V> Set<Map.Entry<K, V>> unmodifiableEntrySet(final Set<Map.Entry<K, V>> set) {
if (set instanceof Unmodifiable) {
return set;
}
@@ -64,18 +64,18 @@ public final class UnmodifiableEntrySet<
* @param set the set to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
- private UnmodifiableEntrySet(Set<Map.Entry<K, V>> set) {
+ private UnmodifiableEntrySet(final Set<Map.Entry<K, V>> set) {
super(set);
}
//-----------------------------------------------------------------------
@Override
- public boolean add(Map.Entry<K, V> object) {
+ public boolean add(final Map.Entry<K, V> object) {
throw new UnsupportedOperationException();
}
@Override
- public boolean addAll(Collection<? extends Map.Entry<K, V>> coll) {
+ public boolean addAll(final Collection<? extends Map.Entry<K, V>> coll) {
throw new UnsupportedOperationException();
}
@@ -85,17 +85,17 @@ public final class UnmodifiableEntrySet<
}
@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();
}
@@ -108,7 +108,7 @@ public final class UnmodifiableEntrySet<
@Override
@SuppressWarnings("unchecked")
public Object[] toArray() {
- Object[] array = collection.toArray();
+ final Object[] array = collection.toArray();
for (int i = 0; i < array.length; i++) {
array[i] = new UnmodifiableEntry((Map.Entry<K, V>) array[i]);
}
@@ -117,7 +117,7 @@ public final class UnmodifiableEntrySet<
@Override
@SuppressWarnings("unchecked")
- public <T> T[] toArray(T[] array) {
+ public <T> T[] toArray(final T[] array) {
Object[] result = array;
if (array.length > 0) {
// we must create a new array to handle multi-threaded situations
@@ -148,7 +148,7 @@ public final class UnmodifiableEntrySet<
*/
private class UnmodifiableEntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, V>> {
- protected UnmodifiableEntrySetIterator(Iterator<Map.Entry<K, V>> iterator) {
+ protected UnmodifiableEntrySetIterator(final Iterator<Map.Entry<K, V>> iterator) {
super(iterator);
}
@@ -169,12 +169,12 @@ public final class UnmodifiableEntrySet<
*/
private class UnmodifiableEntry extends AbstractMapEntryDecorator<K, V> {
- protected UnmodifiableEntry(Map.Entry<K, V> entry) {
+ protected UnmodifiableEntry(final Map.Entry<K, V> entry) {
super(entry);
}
@Override
- public V setValue(V obj) {
+ public V setValue(final V obj) {
throw new UnsupportedOperationException();
}
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableMap.java Mon Jan 7 17:15:14 2013
@@ -58,7 +58,7 @@ public final class UnmodifiableMap<K, V>
* @return a new unmodifiable map
* @throws IllegalArgumentException if 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) {
if (map instanceof Unmodifiable) {
return map;
}
@@ -72,7 +72,7 @@ public final class UnmodifiableMap<K, V>
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
- private UnmodifiableMap(Map<K, V> map) {
+ private UnmodifiableMap(final Map<K, V> map) {
super(map);
}
@@ -84,7 +84,7 @@ public final class UnmodifiableMap<K, V>
* @throws IOException
* @since 3.1
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(map);
}
@@ -98,7 +98,7 @@ public final class UnmodifiableMap<K, V>
* @since 3.1
*/
@SuppressWarnings("unchecked")
- 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();
}
@@ -110,45 +110,45 @@ public final class UnmodifiableMap<K, V>
}
@Override
- public V put(K key, V value) {
+ public V put(final K key, final V value) {
throw new UnsupportedOperationException();
}
@Override
- public void putAll(Map<? extends K, ? extends V> mapToCopy) {
+ public void putAll(final Map<? extends K, ? extends V> mapToCopy) {
throw new UnsupportedOperationException();
}
@Override
- public V remove(Object key) {
+ public V remove(final Object key) {
throw new UnsupportedOperationException();
}
@Override
public MapIterator<K, V> mapIterator() {
if (map instanceof IterableMap) {
- MapIterator<K, V> it = ((IterableMap<K, V>) map).mapIterator();
+ final MapIterator<K, V> it = ((IterableMap<K, V>) map).mapIterator();
return UnmodifiableMapIterator.unmodifiableMapIterator(it);
}
- MapIterator<K, V> it = new EntrySetMapIterator<K, V>(map);
+ final MapIterator<K, V> it = new EntrySetMapIterator<K, V>(map);
return UnmodifiableMapIterator.unmodifiableMapIterator(it);
}
@Override
public Set<Map.Entry<K, V>> entrySet() {
- Set<Map.Entry<K, V>> set = super.entrySet();
+ final Set<Map.Entry<K, V>> set = super.entrySet();
return UnmodifiableEntrySet.unmodifiableEntrySet(set);
}
@Override
public Set<K> keySet() {
- Set<K> set = super.keySet();
+ final Set<K> set = super.keySet();
return UnmodifiableSet.unmodifiableSet(set);
}
@Override
public Collection<V> values() {
- Collection<V> coll = super.values();
+ final Collection<V> coll = super.values();
return UnmodifiableCollection.unmodifiableCollection(coll);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java Mon Jan 7 17:15:14 2013
@@ -56,7 +56,7 @@ public final class UnmodifiableOrderedMa
* @return a new ordered map
* @throws IllegalArgumentException if map is null
*/
- public static <K, V> OrderedMap<K, V> unmodifiableOrderedMap(OrderedMap<K, V> map) {
+ public static <K, V> OrderedMap<K, V> unmodifiableOrderedMap(final OrderedMap<K, V> map) {
if (map instanceof Unmodifiable) {
return map;
}
@@ -70,7 +70,7 @@ public final class UnmodifiableOrderedMa
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
- private UnmodifiableOrderedMap(OrderedMap<K, V> map) {
+ private UnmodifiableOrderedMap(final OrderedMap<K, V> map) {
super(map);
}
@@ -82,7 +82,7 @@ public final class UnmodifiableOrderedMa
* @throws IOException
* @since 3.1
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(map);
}
@@ -96,7 +96,7 @@ public final class UnmodifiableOrderedMa
* @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)
}
@@ -104,7 +104,7 @@ public final class UnmodifiableOrderedMa
//-----------------------------------------------------------------------
@Override
public OrderedMapIterator<K, V> mapIterator() {
- OrderedMapIterator<K, V> it = decorated().mapIterator();
+ final OrderedMapIterator<K, V> it = decorated().mapIterator();
return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it);
}
@@ -114,35 +114,35 @@ public final class UnmodifiableOrderedMa
}
@Override
- public V put(K key, V value) {
+ public V put(final K key, final V value) {
throw new UnsupportedOperationException();
}
@Override
- public void putAll(Map<? extends K, ? extends V> mapToCopy) {
+ public void putAll(final Map<? extends K, ? extends V> mapToCopy) {
throw new UnsupportedOperationException();
}
@Override
- public V remove(Object key) {
+ public V remove(final Object key) {
throw new UnsupportedOperationException();
}
@Override
public Set<Map.Entry<K, V>> entrySet() {
- Set<Map.Entry<K, V>> set = super.entrySet();
+ final Set<Map.Entry<K, V>> set = super.entrySet();
return UnmodifiableEntrySet.unmodifiableEntrySet(set);
}
@Override
public Set<K> keySet() {
- Set<K> set = super.keySet();
+ final Set<K> set = super.keySet();
return UnmodifiableSet.unmodifiableSet(set);
}
@Override
public Collection<V> values() {
- Collection<V> coll = super.values();
+ final Collection<V> coll = super.values();
return UnmodifiableCollection.unmodifiableCollection(coll);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java Mon Jan 7 17:15:14 2013
@@ -56,7 +56,7 @@ public final class UnmodifiableSortedMap
* @return a new unmodifiable sorted map
* @throws IllegalArgumentException if 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) {
if (map instanceof Unmodifiable) {
return map;
}
@@ -70,7 +70,7 @@ public final class UnmodifiableSortedMap
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
- private UnmodifiableSortedMap(SortedMap<K, V> map) {
+ private UnmodifiableSortedMap(final SortedMap<K, V> map) {
super(map);
}
@@ -82,7 +82,7 @@ public final class UnmodifiableSortedMap
* @throws IOException
* @since 3.1
*/
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(map);
}
@@ -96,7 +96,7 @@ public final class UnmodifiableSortedMap
* @since 3.1
*/
@SuppressWarnings("unchecked")
- 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();
}
@@ -108,17 +108,17 @@ public final class UnmodifiableSortedMap
}
@Override
- public V put(K key, V value) {
+ public V put(final K key, final V value) {
throw new UnsupportedOperationException();
}
@Override
- public void putAll(Map<? extends K, ? extends V> mapToCopy) {
+ public void putAll(final Map<? extends K, ? extends V> mapToCopy) {
throw new UnsupportedOperationException();
}
@Override
- public V remove(Object key) {
+ public V remove(final Object key) {
throw new UnsupportedOperationException();
}
@@ -154,17 +154,17 @@ public final class UnmodifiableSortedMap
}
@Override
- public SortedMap<K, V> subMap(K fromKey, K toKey) {
+ public SortedMap<K, V> subMap(final K fromKey, final K toKey) {
return new UnmodifiableSortedMap<K, V>(decorated().subMap(fromKey, toKey));
}
@Override
- public SortedMap<K, V> headMap(K toKey) {
+ public SortedMap<K, V> headMap(final K toKey) {
return new UnmodifiableSortedMap<K, V>(decorated().headMap(toKey));
}
@Override
- public SortedMap<K, V> tailMap(K fromKey) {
+ public SortedMap<K, V> tailMap(final K fromKey) {
return new UnmodifiableSortedMap<K, V>(decorated().tailMap(fromKey));
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSerializableSetDecorator.java Mon Jan 7 17:15:14 2013
@@ -42,7 +42,7 @@ public abstract class AbstractSerializab
* @param set the list to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
- protected AbstractSerializableSetDecorator(Set<E> set) {
+ protected AbstractSerializableSetDecorator(final Set<E> set) {
super(set);
}
@@ -53,7 +53,7 @@ public abstract class AbstractSerializab
* @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);
}
@@ -66,7 +66,7 @@ public abstract class AbstractSerializab
* @throws ClassNotFoundException
*/
@SuppressWarnings("unchecked")
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
collection = (Collection<E>) in.readObject();
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSetDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSetDecorator.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSetDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSetDecorator.java Mon Jan 7 17:15:14 2013
@@ -49,7 +49,7 @@ public abstract class AbstractSetDecorat
* @param set the set to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
- protected AbstractSetDecorator(Set<E> set) {
+ protected AbstractSetDecorator(final Set<E> set) {
super(set);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/AbstractSortedSetDecorator.java Mon Jan 7 17:15:14 2013
@@ -50,7 +50,7 @@ public abstract class AbstractSortedSetD
* @param set the set to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
- protected AbstractSortedSetDecorator(Set<E> set) {
+ protected AbstractSortedSetDecorator(final Set<E> set) {
super(set);
}
@@ -65,15 +65,15 @@ public abstract class AbstractSortedSetD
}
//-----------------------------------------------------------------------
- public SortedSet<E> subSet(E fromElement, E toElement) {
+ public SortedSet<E> subSet(final E fromElement, final E toElement) {
return decorated().subSet(fromElement, toElement);
}
- public SortedSet<E> headSet(E toElement) {
+ public SortedSet<E> headSet(final E toElement) {
return decorated().headSet(toElement);
}
- public SortedSet<E> tailSet(E fromElement) {
+ public SortedSet<E> tailSet(final E fromElement) {
return decorated().tailSet(fromElement);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/CompositeSet.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/CompositeSet.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/CompositeSet.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/set/CompositeSet.java Mon Jan 7 17:15:14 2013
@@ -50,7 +50,7 @@ public class CompositeSet<E> extends Com
*
* @param set the initial set in the composite
*/
- public CompositeSet(Set<E> set) {
+ public CompositeSet(final Set<E> set) {
super(set);
}
@@ -59,7 +59,7 @@ public class CompositeSet<E> extends Com
*
* @param sets the initial sets in the composite
*/
- public CompositeSet(Set<E>... sets) {
+ public CompositeSet(final Set<E>... sets) {
super(sets);
}
@@ -75,13 +75,13 @@ public class CompositeSet<E> extends Com
* @see SetMutator
*/
@Override
- public synchronized void addComposited(Collection<E> c) {
+ public synchronized void addComposited(final Collection<E> c) {
if (!(c instanceof Set)) {
throw new IllegalArgumentException("Collections added must implement java.util.Set");
}
- for (Set<E> set : getCollections()) {
- Collection<E> intersects = CollectionUtils.intersection(set, c);
+ for (final Set<E> set : getCollections()) {
+ final Collection<E> intersects = CollectionUtils.intersection(set, c);
if (intersects.size() > 0) {
if (this.mutator == null) {
throw new UnsupportedOperationException(
@@ -117,7 +117,7 @@ public class CompositeSet<E> extends Com
*/
@Override
@SuppressWarnings("unchecked")
- public synchronized void addComposited(Collection<E> c, Collection<E> d) {
+ public synchronized void addComposited(final Collection<E> c, final Collection<E> d) {
if (!(c instanceof Set)) {
throw new IllegalArgumentException("Argument must implement java.util.Set");
}
@@ -133,7 +133,7 @@ public class CompositeSet<E> extends Com
* @throws IllegalArgumentException if any of the collections in comps do not implement Set
*/
@Override
- public synchronized void addComposited(Collection<E>[] comps) {
+ public synchronized void addComposited(final Collection<E>[] comps) {
for (int i = comps.length - 1; i >= 0; --i) {
this.addComposited(comps[i]);
}
@@ -147,7 +147,7 @@ public class CompositeSet<E> extends Com
* @param mutator the {@link CollectionMutator} to use for this composite
*/
@Override
- public void setMutator(CollectionMutator<E> mutator) {
+ public void setMutator(final CollectionMutator<E> mutator) {
super.setMutator(mutator);
}
@@ -161,8 +161,8 @@ public class CompositeSet<E> extends Com
* @return true if the object is removed, false otherwise
*/
@Override
- public boolean remove(Object obj) {
- for (Set<? extends E> set : getCollections()) {
+ public boolean remove(final Object obj) {
+ for (final Set<? extends E> set : getCollections()) {
if (set.contains(obj)) {
return set.remove(obj);
}
@@ -174,9 +174,9 @@ public class CompositeSet<E> extends Com
* @see Set#equals
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj instanceof Set) {
- Set<?> set = (Set<?>) obj;
+ final Set<?> set = (Set<?>) obj;
return set.containsAll(this) && set.size() == this.size();
}
return false;
@@ -188,7 +188,7 @@ public class CompositeSet<E> extends Com
@Override
public int hashCode() {
int code = 0;
- for (E e : this) {
+ for (final E e : this) {
code += e == null ? 0 : e.hashCode();
}
return code;