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 [24/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/test/java/org/apache/commons/collections/map/CaseInsensitiveMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CaseInsensitiveMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CaseInsensitiveMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CaseInsensitiveMapTest.java Mon Jan 7 17:15:14 2013
@@ -33,7 +33,7 @@ import org.apache.commons.collections.Bu
*/
public class CaseInsensitiveMapTest<K, V> extends AbstractIterableMapTest<K, V> {
- public CaseInsensitiveMapTest(String testName) {
+ public CaseInsensitiveMapTest(final String testName) {
super(testName);
}
@@ -55,7 +55,7 @@ public class CaseInsensitiveMapTest<K, V
@SuppressWarnings("unchecked")
public void testCaseInsensitive() {
- Map<K, V> map = makeObject();
+ final Map<K, V> map = makeObject();
map.put((K) "One", (V) "One");
map.put((K) "Two", (V) "Two");
assertEquals("One", map.get("one"));
@@ -66,14 +66,14 @@ public class CaseInsensitiveMapTest<K, V
@SuppressWarnings("unchecked")
public void testNullHandling() {
- Map<K, V> map = makeObject();
+ final Map<K, V> map = makeObject();
map.put((K) "One", (V) "One");
map.put((K) "Two", (V) "Two");
map.put(null, (V) "Three");
assertEquals("Three", map.get(null));
map.put(null, (V) "Four");
assertEquals("Four", map.get(null));
- Set<K> keys = map.keySet();
+ final Set<K> keys = map.keySet();
assertTrue(keys.contains("one"));
assertTrue(keys.contains("two"));
assertTrue(keys.contains(null));
@@ -81,15 +81,15 @@ public class CaseInsensitiveMapTest<K, V
}
public void testPutAll() {
- Map<Object, String> map = new HashMap<Object, String>();
+ final Map<Object, String> map = new HashMap<Object, String>();
map.put("One", "One");
map.put("Two", "Two");
map.put("one", "Three");
map.put(null, "Four");
map.put(new Integer(20), "Five");
- Map<Object, String> caseInsensitiveMap = new CaseInsensitiveMap<Object, String>(map);
+ final Map<Object, String> caseInsensitiveMap = new CaseInsensitiveMap<Object, String>(map);
assertEquals(4, caseInsensitiveMap.size()); // ones collapsed
- Set<Object> keys = caseInsensitiveMap.keySet();
+ final Set<Object> keys = caseInsensitiveMap.keySet();
assertTrue(keys.contains("one"));
assertTrue(keys.contains("two"));
assertTrue(keys.contains(null));
@@ -102,9 +102,9 @@ public class CaseInsensitiveMapTest<K, V
@SuppressWarnings("unchecked")
public void testClone() {
- CaseInsensitiveMap<K, V> map = new CaseInsensitiveMap<K, V>(10);
+ final CaseInsensitiveMap<K, V> map = new CaseInsensitiveMap<K, V>(10);
map.put((K) "1", (V) "1");
- CaseInsensitiveMap<K, V> cloned = map.clone();
+ final CaseInsensitiveMap<K, V> cloned = map.clone();
assertEquals(map.size(), cloned.size());
assertSame(map.get("1"), cloned.get("1"));
}
@@ -120,11 +120,11 @@ public class CaseInsensitiveMapTest<K, V
// COLLECTIONS-294
public void testLocaleIndependence() {
- Locale orig = Locale.getDefault();
+ final Locale orig = Locale.getDefault();
- Locale[] locales = { Locale.ENGLISH, new Locale("tr", "", ""), Locale.getDefault() };
+ final Locale[] locales = { Locale.ENGLISH, new Locale("tr", "", ""), Locale.getDefault() };
- String[][] data = {
+ final String[][] data = {
{ "i", "I" },
{ "\u03C2", "\u03C3" },
{ "\u03A3", "\u03C2" },
@@ -132,11 +132,11 @@ public class CaseInsensitiveMapTest<K, V
};
try {
- for (Locale locale : locales) {
+ for (final Locale locale : locales) {
Locale.setDefault(locale);
for (int j = 0; j < data.length; j++) {
assertTrue("Test data corrupt: " + j, data[j][0].equalsIgnoreCase(data[j][1]));
- CaseInsensitiveMap<String, String> map = new CaseInsensitiveMap<String, String>();
+ final CaseInsensitiveMap<String, String> map = new CaseInsensitiveMap<String, String>();
map.put(data[j][0], "value");
assertEquals(Locale.getDefault() + ": " + j, "value", map.get(data[j][1]));
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CompositeMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CompositeMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CompositeMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/CompositeMapTest.java Mon Jan 7 17:15:14 2013
@@ -35,7 +35,7 @@ public class CompositeMapTest<K, V> exte
/** used as a flag in MapMutator tests */
private boolean pass = false;
- public CompositeMapTest(String testName) {
+ public CompositeMapTest(final String testName) {
super(testName);
}
@@ -47,7 +47,7 @@ public class CompositeMapTest<K, V> exte
@Override
public CompositeMap<K, V> makeObject() {
- CompositeMap<K, V> map = new CompositeMap<K, V>();
+ final CompositeMap<K, V> map = new CompositeMap<K, V>();
map.addComposited(new HashMap<K, V>());
map.setMutator( new EmptyMapMutator<K, V>() );
return map;
@@ -55,7 +55,7 @@ public class CompositeMapTest<K, V> exte
@SuppressWarnings("unchecked")
private Map<K, V> buildOne() {
- HashMap<K, V> map = new HashMap<K, V>();
+ final HashMap<K, V> map = new HashMap<K, V>();
map.put((K) "1", (V) "one");
map.put((K) "2", (V) "two");
return map;
@@ -63,37 +63,37 @@ public class CompositeMapTest<K, V> exte
@SuppressWarnings("unchecked")
public Map<K, V> buildTwo() {
- HashMap<K, V> map = new HashMap<K, V>();
+ final HashMap<K, V> map = new HashMap<K, V>();
map.put((K) "3", (V) "three");
map.put((K) "4", (V) "four");
return map;
}
public void testGet() {
- CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
+ final CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
Assert.assertEquals("one", map.get("1"));
Assert.assertEquals("four", map.get("4"));
}
@SuppressWarnings("unchecked")
public void testAddComposited() {
- CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
- HashMap<K, V> three = new HashMap<K, V>();
+ final CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
+ final HashMap<K, V> three = new HashMap<K, V>();
three.put((K) "5", (V) "five");
map.addComposited(three);
assertTrue(map.containsKey("5"));
try {
map.addComposited(three);
fail("Expecting IllegalArgumentException.");
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
// expected
}
}
@SuppressWarnings("unchecked")
public void testRemoveComposited() {
- CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
- HashMap<K, V> three = new HashMap<K, V>();
+ final CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
+ final HashMap<K, V> three = new HashMap<K, V>();
three.put((K) "5", (V) "five");
map.addComposited(three);
assertTrue(map.containsKey("5"));
@@ -108,8 +108,8 @@ public class CompositeMapTest<K, V> exte
@SuppressWarnings("unchecked")
public void testRemoveFromUnderlying() {
- CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
- HashMap<K, V> three = new HashMap<K, V>();
+ final CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
+ final HashMap<K, V> three = new HashMap<K, V>();
three.put((K) "5", (V) "five");
map.addComposited(three);
assertTrue(map.containsKey("5"));
@@ -121,8 +121,8 @@ public class CompositeMapTest<K, V> exte
@SuppressWarnings("unchecked")
public void testRemoveFromComposited() {
- CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
- HashMap<K, V> three = new HashMap<K, V>();
+ final CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo());
+ final HashMap<K, V> three = new HashMap<K, V>();
three.put((K) "5", (V) "five");
map.addComposited(three);
assertTrue(map.containsKey("5"));
@@ -133,23 +133,23 @@ public class CompositeMapTest<K, V> exte
}
public void testResolveCollision() {
- CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo(),
+ final CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo(),
new CompositeMap.MapMutator<K, V>() {
private static final long serialVersionUID = 1L;
- public void resolveCollision(CompositeMap<K, V> composite,
- Map<K, V> existing,
- Map<K, V> added,
- Collection<K> intersect) {
+ public void resolveCollision(final CompositeMap<K, V> composite,
+ final Map<K, V> existing,
+ final Map<K, V> added,
+ final Collection<K> intersect) {
pass = true;
}
- public V put(CompositeMap<K, V> map, Map<K, V>[] composited, K key,
- V value) {
+ public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key,
+ final V value) {
throw new UnsupportedOperationException();
}
- public void putAll(CompositeMap<K, V> map, Map<K, V>[] composited, Map<? extends K, ? extends V> t) {
+ public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) {
throw new UnsupportedOperationException();
}
});
@@ -160,23 +160,23 @@ public class CompositeMapTest<K, V> exte
@SuppressWarnings("unchecked")
public void testPut() {
- CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo(),
+ final CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo(),
new CompositeMap.MapMutator<K, V>() {
private static final long serialVersionUID = 1L;
- public void resolveCollision(CompositeMap<K, V> composite,
- Map<K, V> existing,
- Map<K, V> added,
- Collection<K> intersect) {
+ public void resolveCollision(final CompositeMap<K, V> composite,
+ final Map<K, V> existing,
+ final Map<K, V> added,
+ final Collection<K> intersect) {
throw new UnsupportedOperationException();
}
- public V put(CompositeMap<K, V> map, Map<K, V>[] composited, K key,
- V value) {
+ public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key,
+ final V value) {
pass = true;
return (V) "foo";
}
- public void putAll(CompositeMap<K, V> map, Map<K, V>[] composited, Map<? extends K, ? extends V> t) {
+ public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) {
throw new UnsupportedOperationException();
}
});
@@ -186,22 +186,22 @@ public class CompositeMapTest<K, V> exte
}
public void testPutAll() {
- CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo(),
+ final CompositeMap<K, V> map = new CompositeMap<K, V>(buildOne(), buildTwo(),
new CompositeMap.MapMutator<K, V>() {
private static final long serialVersionUID = 1L;
- public void resolveCollision(CompositeMap<K, V> composite,
- Map<K, V> existing,
- Map<K, V> added,
- Collection<K> intersect) {
+ public void resolveCollision(final CompositeMap<K, V> composite,
+ final Map<K, V> existing,
+ final Map<K, V> added,
+ final Collection<K> intersect) {
throw new UnsupportedOperationException();
}
- public V put(CompositeMap<K, V> map, Map<K, V>[] composited, K key,
- V value) {
+ public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key,
+ final V value) {
throw new UnsupportedOperationException();
}
- public void putAll(CompositeMap<K, V> map, Map<K, V>[] composited, Map<? extends K, ? extends V> t) {
+ public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) {
pass = true;
}
});
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/DefaultedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/DefaultedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/DefaultedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/DefaultedMapTest.java Mon Jan 7 17:15:14 2013
@@ -38,7 +38,7 @@ public class DefaultedMapTest<K, V> exte
protected final Factory<V> nullFactory = FactoryUtils.<V>nullFactory();
- public DefaultedMapTest(String testName) {
+ public DefaultedMapTest(final String testName) {
super(testName);
}
@@ -52,7 +52,7 @@ public class DefaultedMapTest<K, V> exte
@Override
@SuppressWarnings("unchecked")
public void testMapGet() {
- Map<K, V> map = new DefaultedMap<K, V>((V) "NULL");
+ final Map<K, V> map = new DefaultedMap<K, V>((V) "NULL");
assertEquals(0, map.size());
assertEquals(false, map.containsKey("NotInMap"));
@@ -68,8 +68,8 @@ public class DefaultedMapTest<K, V> exte
@SuppressWarnings("unchecked")
public void testMapGet2() {
- HashMap<K, V> base = new HashMap<K, V>();
- Map<K, V> map = DefaultedMap.defaultedMap(base, (V) "NULL");
+ final HashMap<K, V> base = new HashMap<K, V>();
+ final Map<K, V> map = DefaultedMap.defaultedMap(base, (V) "NULL");
assertEquals(0, map.size());
assertEquals(0, base.size());
@@ -87,8 +87,8 @@ public class DefaultedMapTest<K, V> exte
@SuppressWarnings("unchecked")
public void testMapGet3() {
- HashMap<K, V> base = new HashMap<K, V>();
- Map<K, V> map = DefaultedMap.defaultedMap(base, ConstantFactory.constantFactory((V) "NULL"));
+ final HashMap<K, V> base = new HashMap<K, V>();
+ final Map<K, V> map = DefaultedMap.defaultedMap(base, ConstantFactory.constantFactory((V) "NULL"));
assertEquals(0, map.size());
assertEquals(0, base.size());
@@ -106,9 +106,9 @@ public class DefaultedMapTest<K, V> exte
@SuppressWarnings("unchecked")
public void testMapGet4() {
- HashMap<K, V> base = new HashMap<K, V>();
- Map<K, V> map = DefaultedMap.defaultedMap(base, new Transformer<K, V>() {
- public V transform(K input) {
+ final HashMap<K, V> base = new HashMap<K, V>();
+ final Map<K, V> map = DefaultedMap.defaultedMap(base, new Transformer<K, V>() {
+ public V transform(final K input) {
if (input instanceof String) {
return (V) "NULL";
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/EmptyMapMutator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/EmptyMapMutator.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/EmptyMapMutator.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/EmptyMapMutator.java Mon Jan 7 17:15:14 2013
@@ -28,18 +28,18 @@ class EmptyMapMutator<K,V> implements Co
/** Serialization version */
private static final long serialVersionUID = -2729718980002476794L;
- public void resolveCollision(CompositeMap<K,V> composite,
- Map<K,V> existing,
- Map<K,V> added,
- Collection<K> intersect) {
+ public void resolveCollision(final CompositeMap<K,V> composite,
+ final Map<K,V> existing,
+ final Map<K,V> added,
+ final Collection<K> intersect) {
// Do nothing
}
- public V put(CompositeMap<K, V> map, Map<K, V>[] composited, K key, V value) {
+ public V put(final CompositeMap<K, V> map, final Map<K, V>[] composited, final K key, final V value) {
return composited[0].put(key, value);
}
- public void putAll(CompositeMap<K, V> map, Map<K, V>[] composited, Map<? extends K, ? extends V> t) {
+ public void putAll(final CompositeMap<K, V> map, final Map<K, V>[] composited, final Map<? extends K, ? extends V> t) {
composited[0].putAll(t);
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/FixedSizeMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/FixedSizeMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/FixedSizeMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/FixedSizeMapTest.java Mon Jan 7 17:15:14 2013
@@ -32,7 +32,7 @@ import org.apache.commons.collections.It
*/
public class FixedSizeMapTest<K, V> extends AbstractIterableMapTest<K, V> {
- public FixedSizeMapTest(String testName) {
+ public FixedSizeMapTest(final String testName) {
super(testName);
}
@@ -43,7 +43,7 @@ public class FixedSizeMapTest<K, V> exte
@Override
public IterableMap<K, V> makeFullMap() {
- Map<K, V> map = new HashMap<K, V>();
+ final Map<K, V> map = new HashMap<K, V>();
addSampleMappings(map);
return FixedSizeMap.fixedSizeMap(map);
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/FixedSizeSortedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/FixedSizeSortedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/FixedSizeSortedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/FixedSizeSortedMapTest.java Mon Jan 7 17:15:14 2013
@@ -34,7 +34,7 @@ import org.apache.commons.collections.Bu
*/
public class FixedSizeSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
- public FixedSizeSortedMapTest(String testName) {
+ public FixedSizeSortedMapTest(final String testName) {
super(testName);
}
@@ -50,7 +50,7 @@ public class FixedSizeSortedMapTest<K, V
@Override
public SortedMap<K, V> makeFullMap() {
- SortedMap<K, V> map = new TreeMap<K, V>();
+ final SortedMap<K, V> map = new TreeMap<K, V>();
addSampleMappings(map);
return FixedSizeSortedMap.fixedSizeSortedMap(map);
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/Flat3MapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/Flat3MapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/Flat3MapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/Flat3MapTest.java Mon Jan 7 17:15:14 2013
@@ -45,7 +45,7 @@ public class Flat3MapTest<K, V> extends
private static final String TWENTY = "20";
private static final String THIRTY = "30";
- public Flat3MapTest(String testName) {
+ public Flat3MapTest(final String testName) {
super(testName);
}
@@ -61,10 +61,10 @@ public class Flat3MapTest<K, V> extends
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testEquals1() {
- Flat3Map<K, V> map1 = makeObject();
+ final Flat3Map<K, V> map1 = makeObject();
map1.put((K) "a", (V) "testA");
map1.put((K) "b", (V) "testB");
- Flat3Map<K, V> map2 = makeObject();
+ final Flat3Map<K, V> map2 = makeObject();
map2.put((K) "a", (V) "testB");
map2.put((K) "b", (V) "testA");
assertEquals(false, map1.equals(map2));
@@ -72,10 +72,10 @@ public class Flat3MapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testEquals2() {
- Flat3Map<K, V> map1 = makeObject();
+ final Flat3Map<K, V> map1 = makeObject();
map1.put((K) "a", (V) "testA");
map1.put((K) "b", (V) "testB");
- Flat3Map<K, V> map2 = makeObject();
+ final Flat3Map<K, V> map2 = makeObject();
map2.put((K) "a", (V) "testB");
map2.put((K) "c", (V) "testA");
assertEquals(false, map1.equals(map2));
@@ -83,7 +83,7 @@ public class Flat3MapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testClone2() {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
assertEquals(0, map.size());
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
@@ -94,7 +94,7 @@ public class Flat3MapTest<K, V> extends
assertSame(TWENTY, map.get(TWO));
// clone works (size = 2)
- Flat3Map<K, V> cloned = map.clone();
+ final Flat3Map<K, V> cloned = map.clone();
assertEquals(2, cloned.size());
assertEquals(true, cloned.containsKey(ONE));
assertEquals(true, cloned.containsKey(TWO));
@@ -114,7 +114,7 @@ public class Flat3MapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testClone4() {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
assertEquals(0, map.size());
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
@@ -122,7 +122,7 @@ public class Flat3MapTest<K, V> extends
map.put((K) TWENTY, (V) TWO);
// clone works (size = 4)
- Flat3Map<K, V> cloned = map.clone();
+ final Flat3Map<K, V> cloned = map.clone();
assertEquals(4, map.size());
assertEquals(4, cloned.size());
assertEquals(true, cloned.containsKey(ONE));
@@ -149,15 +149,15 @@ public class Flat3MapTest<K, V> extends
}
public void testSerialisation0() throws Exception {
- Flat3Map<K, V> map = makeObject();
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bout);
+ final Flat3Map<K, V> map = makeObject();
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ final ObjectOutputStream out = new ObjectOutputStream(bout);
out.writeObject(map);
- byte[] bytes = bout.toByteArray();
+ final byte[] bytes = bout.toByteArray();
out.close();
- ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
- ObjectInputStream in = new ObjectInputStream(bin);
- Flat3Map<?, ?> ser = (Flat3Map<?, ?>) in.readObject();
+ final ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
+ final ObjectInputStream in = new ObjectInputStream(bin);
+ final Flat3Map<?, ?> ser = (Flat3Map<?, ?>) in.readObject();
in.close();
assertEquals(0, map.size());
assertEquals(0, ser.size());
@@ -165,18 +165,18 @@ public class Flat3MapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testSerialisation2() throws Exception {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bout);
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ final ObjectOutputStream out = new ObjectOutputStream(bout);
out.writeObject(map);
- byte[] bytes = bout.toByteArray();
+ final byte[] bytes = bout.toByteArray();
out.close();
- ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
- ObjectInputStream in = new ObjectInputStream(bin);
- Flat3Map<?, ?> ser = (Flat3Map<?, ?>) in.readObject();
+ final ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
+ final ObjectInputStream in = new ObjectInputStream(bin);
+ final Flat3Map<?, ?> ser = (Flat3Map<?, ?>) in.readObject();
in.close();
assertEquals(2, map.size());
assertEquals(2, ser.size());
@@ -188,20 +188,20 @@ public class Flat3MapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testSerialisation4() throws Exception {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
map.put((K) TEN, (V) ONE);
map.put((K) TWENTY, (V) TWO);
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bout);
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ final ObjectOutputStream out = new ObjectOutputStream(bout);
out.writeObject(map);
- byte[] bytes = bout.toByteArray();
+ final byte[] bytes = bout.toByteArray();
out.close();
- ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
- ObjectInputStream in = new ObjectInputStream(bin);
- Flat3Map<?, ?> ser = (Flat3Map<?, ?>) in.readObject();
+ final ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
+ final ObjectInputStream in = new ObjectInputStream(bin);
+ final Flat3Map<?, ?> ser = (Flat3Map<?, ?>) in.readObject();
in.close();
assertEquals(4, map.size());
assertEquals(4, ser.size());
@@ -218,13 +218,13 @@ public class Flat3MapTest<K, V> extends
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testEntryIteratorSetValue1() throws Exception {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
map.put((K) THREE, (V) THIRTY);
- Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
- Map.Entry<K, V> entry = it.next();
+ final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+ final Map.Entry<K, V> entry = it.next();
entry.setValue((V) "NewValue");
assertEquals(3, map.size());
assertEquals(true, map.containsKey(ONE));
@@ -237,14 +237,14 @@ public class Flat3MapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testEntryIteratorSetValue2() throws Exception {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
map.put((K) THREE, (V) THIRTY);
- Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+ final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
it.next();
- Map.Entry<K, V> entry = it.next();
+ final Map.Entry<K, V> entry = it.next();
entry.setValue((V) "NewValue");
assertEquals(3, map.size());
assertEquals(true, map.containsKey(ONE));
@@ -257,15 +257,15 @@ public class Flat3MapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testEntryIteratorSetValue3() throws Exception {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
map.put((K) THREE, (V) THIRTY);
- Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+ final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
it.next();
it.next();
- Map.Entry<K, V> entry = it.next();
+ final Map.Entry<K, V> entry = it.next();
entry.setValue((V) "NewValue");
assertEquals(3, map.size());
assertEquals(true, map.containsKey(ONE));
@@ -279,12 +279,12 @@ public class Flat3MapTest<K, V> extends
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testMapIteratorSetValue1() throws Exception {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
map.put((K) THREE, (V) THIRTY);
- MapIterator<K, V> it = map.mapIterator();
+ final MapIterator<K, V> it = map.mapIterator();
it.next();
it.setValue((V) "NewValue");
assertEquals(3, map.size());
@@ -298,12 +298,12 @@ public class Flat3MapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testMapIteratorSetValue2() throws Exception {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
map.put((K) THREE, (V) THIRTY);
- MapIterator<K, V> it = map.mapIterator();
+ final MapIterator<K, V> it = map.mapIterator();
it.next();
it.next();
it.setValue((V) "NewValue");
@@ -318,12 +318,12 @@ public class Flat3MapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testMapIteratorSetValue3() throws Exception {
- Flat3Map<K, V> map = makeObject();
+ final Flat3Map<K, V> map = makeObject();
map.put((K) ONE, (V) TEN);
map.put((K) TWO, (V) TWENTY);
map.put((K) THREE, (V) THIRTY);
- MapIterator<K, V> it = map.mapIterator();
+ final MapIterator<K, V> it = map.mapIterator();
it.next();
it.next();
it.next();
@@ -411,7 +411,7 @@ public class Flat3MapTest<K, V> extends
// }
public void testCollections261() {
- Flat3Map<Integer, Integer> m = new Flat3Map<Integer, Integer>();
+ final Flat3Map<Integer, Integer> m = new Flat3Map<Integer, Integer>();
m.put( new Integer(1), new Integer(1) );
m.put( new Integer(0), new Integer(0) );
assertEquals( new Integer(1), m.remove( new Integer(1) ) );
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/HashedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/HashedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/HashedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/HashedMapTest.java Mon Jan 7 17:15:14 2013
@@ -28,7 +28,7 @@ import org.apache.commons.collections.Bu
*/
public class HashedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
- public HashedMapTest(String testName) {
+ public HashedMapTest(final String testName) {
super(testName);
}
@@ -48,15 +48,15 @@ public class HashedMapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testClone() {
- HashedMap<K, V> map = new HashedMap<K, V>(10);
+ final HashedMap<K, V> map = new HashedMap<K, V>(10);
map.put((K) "1", (V) "1");
- HashedMap<K, V> cloned = map.clone();
+ final HashedMap<K, V> cloned = map.clone();
assertEquals(map.size(), cloned.size());
assertSame(map.get("1"), cloned.get("1"));
}
public void testInternalState() {
- HashedMap<K, V> map = new HashedMap<K, V>(42, 0.75f);
+ final HashedMap<K, V> map = new HashedMap<K, V>(42, 0.75f);
assertEquals(0.75f, map.loadFactor, 0.1f);
assertEquals(0, map.size);
assertEquals(64, map.data.length);
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/IdentityMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/IdentityMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/IdentityMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/IdentityMapTest.java Mon Jan 7 17:15:14 2013
@@ -40,7 +40,7 @@ public class IdentityMapTest<K, V> exten
private static final Integer I2A = new Integer(2);
private static final Integer I2B = new Integer(2);
- public IdentityMapTest(String testName) {
+ public IdentityMapTest(final String testName) {
super(testName);
}
@@ -62,7 +62,7 @@ public class IdentityMapTest<K, V> exten
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testBasics() {
- IterableMap<K, V> map = new IdentityMap<K, V>();
+ final IterableMap<K, V> map = new IdentityMap<K, V>();
assertEquals(0, map.size());
map.put((K) I1A, (V) I2A);
@@ -96,15 +96,15 @@ public class IdentityMapTest<K, V> exten
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testHashEntry() {
- IterableMap<K, V> map = new IdentityMap<K, V>();
+ final IterableMap<K, V> map = new IdentityMap<K, V>();
map.put((K) I1A, (V) I2A);
map.put((K) I1B, (V) I2A);
- Map.Entry<K, V> entry1 = map.entrySet().iterator().next();
- Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
- Map.Entry<K, V> entry2 = it.next();
- Map.Entry<K, V> entry3 = it.next();
+ final Map.Entry<K, V> entry1 = map.entrySet().iterator().next();
+ final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+ final Map.Entry<K, V> entry2 = it.next();
+ final Map.Entry<K, V> entry3 = it.next();
assertEquals(true, entry1.equals(entry2));
assertEquals(true, entry2.equals(entry1));
@@ -117,9 +117,10 @@ public class IdentityMapTest<K, V> exten
*/
public void testEmptyMapCompatibility() throws IOException, ClassNotFoundException {
// test to make sure the canonical form has been preserved
- Map<K, V> map = makeObject();
+ final Map<K, V> map = makeObject();
if (map instanceof Serializable && !skipSerializedCanonicalTests()) {
@SuppressWarnings("unchecked")
+ final
Map<K, V> map2 = (Map<K, V>) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
assertEquals("Map is empty", 0, map2.size());
}
@@ -127,9 +128,9 @@ public class IdentityMapTest<K, V> exten
@SuppressWarnings("unchecked")
public void testClone() {
- IdentityMap<K, V> map = new IdentityMap<K, V>(10);
+ final IdentityMap<K, V> map = new IdentityMap<K, V>(10);
map.put((K) "1", (V) "1");
- Map<K, V> cloned = map.clone();
+ final Map<K, V> cloned = map.clone();
assertEquals(map.size(), cloned.size());
assertSame(map.get("1"), cloned.get("1"));
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java Mon Jan 7 17:15:14 2013
@@ -37,7 +37,7 @@ import org.apache.commons.collections.Re
*/
public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
- public LRUMapTest(String testName) {
+ public LRUMapTest(final String testName) {
super(testName);
}
@@ -73,12 +73,12 @@ public class LRUMapTest<K, V> extends Ab
if (isPutAddSupported() == false || isPutChangeSupported() == false) {
return;
}
- K[] keys = getSampleKeys();
- V[] values = getSampleValues();
+ final K[] keys = getSampleKeys();
+ final V[] values = getSampleValues();
Iterator<K> kit;
Iterator<V> vit;
- LRUMap<K, V> map = new LRUMap<K, V>(2);
+ final LRUMap<K, V> map = new LRUMap<K, V>(2);
assertEquals(0, map.size());
assertEquals(false, map.isFull());
assertEquals(2, map.maxSize());
@@ -142,8 +142,8 @@ public class LRUMapTest<K, V> extends Ab
resetFull();
ordered = getMap();
- List<K> list = new ArrayList<K>(ordered.keySet());
- ResettableIterator<K> it = (ResettableIterator<K>) ordered.mapIterator();
+ final List<K> list = new ArrayList<K>(ordered.keySet());
+ final ResettableIterator<K> it = (ResettableIterator<K>) ordered.mapIterator();
assertSame(list.get(0), it.next());
assertSame(list.get(1), it.next());
it.reset();
@@ -155,8 +155,8 @@ public class LRUMapTest<K, V> extends Ab
if (isPutAddSupported() == false || isPutChangeSupported() == false) {
return;
}
- K[] keys = getSampleKeys();
- V[] values = getSampleValues();
+ final K[] keys = getSampleKeys();
+ final V[] values = getSampleValues();
Iterator<K> kit = null;
Iterator<V> vit = null;
@@ -227,16 +227,16 @@ public class LRUMapTest<K, V> extends Ab
@SuppressWarnings("unchecked")
public void testClone() {
- LRUMap<K, V> map = new LRUMap<K, V>(10);
+ final LRUMap<K, V> map = new LRUMap<K, V>(10);
map.put((K) "1", (V) "1");
- Map<K, V> cloned = map.clone();
+ final Map<K, V> cloned = map.clone();
assertEquals(map.size(), cloned.size());
assertSame(map.get("1"), cloned.get("1"));
}
@SuppressWarnings("unchecked")
public void testRemoveLRU() {
- MockLRUMapSubclass<K, String> map = new MockLRUMapSubclass<K, String>(2);
+ final MockLRUMapSubclass<K, String> map = new MockLRUMapSubclass<K, String>(2);
assertNull(map.entry);
map.put((K) "A", "a");
assertNull(map.entry);
@@ -259,12 +259,12 @@ public class LRUMapTest<K, V> extends Ab
K key;
V value;
- MockLRUMapSubclass(int size) {
+ MockLRUMapSubclass(final int size) {
super(size);
}
@Override
- protected boolean removeLRU(LinkEntry<K, V> entry) {
+ protected boolean removeLRU(final LinkEntry<K, V> entry) {
this.entry = entry;
this.key = entry.getKey();
this.value = entry.getValue();
@@ -274,7 +274,7 @@ public class LRUMapTest<K, V> extends Ab
@SuppressWarnings("unchecked")
public void testRemoveLRUBlocksRemove() {
- MockLRUMapSubclassBlocksRemove<K, V> map = new MockLRUMapSubclassBlocksRemove<K, V>(2, false);
+ final MockLRUMapSubclassBlocksRemove<K, V> map = new MockLRUMapSubclassBlocksRemove<K, V>(2, false);
assertEquals(0, map.size());
map.put((K) "A", (V) "a");
assertEquals(1, map.size());
@@ -290,7 +290,7 @@ public class LRUMapTest<K, V> extends Ab
@SuppressWarnings("unchecked")
public void testRemoveLRUBlocksRemoveScan() {
- MockLRUMapSubclassBlocksRemove<K, V> map = new MockLRUMapSubclassBlocksRemove<K, V>(2, true);
+ final MockLRUMapSubclassBlocksRemove<K, V> map = new MockLRUMapSubclassBlocksRemove<K, V>(2, true);
assertEquals(0, map.size());
map.put((K) "A", (V) "a");
assertEquals(1, map.size());
@@ -306,19 +306,19 @@ public class LRUMapTest<K, V> extends Ab
@SuppressWarnings("serial")
static class MockLRUMapSubclassBlocksRemove<K, V> extends LRUMap<K, V> {
- MockLRUMapSubclassBlocksRemove(int size, boolean scanUntilRemove) {
+ MockLRUMapSubclassBlocksRemove(final int size, final boolean scanUntilRemove) {
super(size, scanUntilRemove);
}
@Override
- protected boolean removeLRU(LinkEntry<K, V> entry) {
+ protected boolean removeLRU(final LinkEntry<K, V> entry) {
return false;
}
}
@SuppressWarnings("unchecked")
public void testRemoveLRUFirstBlocksRemove() {
- MockLRUMapSubclassFirstBlocksRemove<K, V> map = new MockLRUMapSubclassFirstBlocksRemove<K, V>(2);
+ final MockLRUMapSubclassFirstBlocksRemove<K, V> map = new MockLRUMapSubclassFirstBlocksRemove<K, V>(2);
assertEquals(0, map.size());
map.put((K) "A", (V) "a");
assertEquals(1, map.size());
@@ -334,12 +334,12 @@ public class LRUMapTest<K, V> extends Ab
@SuppressWarnings("serial")
static class MockLRUMapSubclassFirstBlocksRemove<K, V> extends LRUMap<K, V> {
- MockLRUMapSubclassFirstBlocksRemove(int size) {
+ MockLRUMapSubclassFirstBlocksRemove(final int size) {
super(size, true);
}
@Override
- protected boolean removeLRU(LinkEntry<K, V> entry) {
+ protected boolean removeLRU(final LinkEntry<K, V> entry) {
if ("a".equals(entry.getValue())) {
return false;
} else {
@@ -351,7 +351,7 @@ public class LRUMapTest<K, V> extends Ab
//-----------------------------------------------------------------------
static class SingleHashCode {
private final String code;
- SingleHashCode(String code) {
+ SingleHashCode(final String code) {
this.code = code;
}
@Override
@@ -371,15 +371,15 @@ public class LRUMapTest<K, V> extends Ab
if (isPutAddSupported() == false || isPutChangeSupported() == false) {
return;
}
- SingleHashCode one = new SingleHashCode("1");
- SingleHashCode two = new SingleHashCode("2");
- SingleHashCode three = new SingleHashCode("3");
- SingleHashCode four = new SingleHashCode("4");
- SingleHashCode five = new SingleHashCode("5");
- SingleHashCode six = new SingleHashCode("6");
+ final SingleHashCode one = new SingleHashCode("1");
+ final SingleHashCode two = new SingleHashCode("2");
+ final SingleHashCode three = new SingleHashCode("3");
+ final SingleHashCode four = new SingleHashCode("4");
+ final SingleHashCode five = new SingleHashCode("5");
+ final SingleHashCode six = new SingleHashCode("6");
- LRUMap<K, V> map = new LRUMap<K, V>(3, 1.0f);
- int hashIndex = map.hashIndex(map.hash(one), 4);
+ final LRUMap<K, V> map = new LRUMap<K, V>(3, 1.0f);
+ final int hashIndex = map.hashIndex(map.hash(one), 4);
map.put((K) one, (V) "A");
map.put((K) two, (V) "B");
map.put((K) three, (V) "C");
@@ -461,11 +461,11 @@ public class LRUMapTest<K, V> extends Ab
if (isPutAddSupported() == false || isPutChangeSupported() == false) {
return;
}
- SingleHashCode one = new SingleHashCode("1");
- SingleHashCode two = new SingleHashCode("2");
- SingleHashCode three = new SingleHashCode("3");
+ final SingleHashCode one = new SingleHashCode("1");
+ final SingleHashCode two = new SingleHashCode("2");
+ final SingleHashCode three = new SingleHashCode("3");
- LRUMap<K, V> map = new LRUMap<K, V>(3, 1.0f);
+ final LRUMap<K, V> map = new LRUMap<K, V>(3, 1.0f);
map.put((K) one, (V) "A");
map.put((K) two, (V) "B");
map.put((K) three, (V) "C");
@@ -476,11 +476,11 @@ public class LRUMapTest<K, V> extends Ab
try {
map.getEntry(-1);
fail();
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
map.getEntry(3);
fail();
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
}
public void testSynchronizedRemoveFromMapIterator() throws InterruptedException {
@@ -490,7 +490,7 @@ public class LRUMapTest<K, V> extends Ab
final Map<Throwable, String> exceptions = new HashMap<Throwable, String>();
final ThreadGroup tg = new ThreadGroup(getName()) {
@Override
- public void uncaughtException(Thread t, Throwable e) {
+ public void uncaughtException(final Thread t, final Throwable e) {
exceptions.put(e, t.getName());
super.uncaughtException(t, e);
}
@@ -510,21 +510,21 @@ public class LRUMapTest<K, V> extends Ab
notifyAll();
wait();
}
- Thread thread = Thread.currentThread();
+ final Thread thread = Thread.currentThread();
while (i < 1000 && !interrupted()) {
synchronized (map) {
map.put(thread.getName() + "[" + ++i + "]", thread);
}
}
synchronized (map) {
- for (MapIterator<Object, Thread> iter = map.mapIterator(); iter.hasNext();) {
+ for (final MapIterator<Object, Thread> iter = map.mapIterator(); iter.hasNext();) {
iter.next();
if (iter.getValue() == this) {
iter.remove();
}
}
}
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
fail("Unexpected InterruptedException");
}
if (i > 0) {
@@ -537,14 +537,14 @@ public class LRUMapTest<K, V> extends Ab
};
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.start();
thread.wait();
}
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.notifyAll();
}
@@ -552,10 +552,10 @@ public class LRUMapTest<K, V> extends Ab
Thread.sleep(1000);
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
thread.interrupt();
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.join();
}
@@ -573,7 +573,7 @@ public class LRUMapTest<K, V> extends Ab
final Map<Throwable, String> exceptions = new HashMap<Throwable, String>();
final ThreadGroup tg = new ThreadGroup(getName()) {
@Override
- public void uncaughtException(Thread t, Throwable e) {
+ public void uncaughtException(final Thread t, final Throwable e) {
exceptions.put(e, t.getName());
super.uncaughtException(t, e);
}
@@ -593,21 +593,21 @@ public class LRUMapTest<K, V> extends Ab
notifyAll();
wait();
}
- Thread thread = Thread.currentThread();
+ final Thread thread = Thread.currentThread();
while (i < 1000 && !interrupted()) {
synchronized (map) {
map.put(thread.getName() + "[" + ++i + "]", thread);
}
}
synchronized (map) {
- for (Iterator<Map.Entry<Object, Thread>> iter = map.entrySet().iterator(); iter.hasNext();) {
- Map.Entry<Object, Thread> entry = iter.next();
+ for (final Iterator<Map.Entry<Object, Thread>> iter = map.entrySet().iterator(); iter.hasNext();) {
+ final Map.Entry<Object, Thread> entry = iter.next();
if (entry.getValue() == this) {
iter.remove();
}
}
}
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
fail("Unexpected InterruptedException");
}
if (i > 0) {
@@ -620,14 +620,14 @@ public class LRUMapTest<K, V> extends Ab
};
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.start();
thread.wait();
}
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.notifyAll();
}
@@ -635,10 +635,10 @@ public class LRUMapTest<K, V> extends Ab
Thread.sleep(1000);
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
thread.interrupt();
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.join();
}
@@ -656,7 +656,7 @@ public class LRUMapTest<K, V> extends Ab
final Map<Throwable, String> exceptions = new HashMap<Throwable, String>();
final ThreadGroup tg = new ThreadGroup(getName()) {
@Override
- public void uncaughtException(Thread t, Throwable e) {
+ public void uncaughtException(final Thread t, final Throwable e) {
exceptions.put(e, t.getName());
super.uncaughtException(t, e);
}
@@ -676,21 +676,21 @@ public class LRUMapTest<K, V> extends Ab
notifyAll();
wait();
}
- Thread thread = Thread.currentThread();
+ final Thread thread = Thread.currentThread();
while (i < 1000 && !interrupted()) {
synchronized (map) {
map.put(thread.getName() + "[" + ++i + "]", thread);
}
}
synchronized (map) {
- for (Iterator<Object> iter = map.keySet().iterator(); iter.hasNext();) {
- String name = (String) iter.next();
+ for (final Iterator<Object> iter = map.keySet().iterator(); iter.hasNext();) {
+ final String name = (String) iter.next();
if (name.substring(0, name.indexOf('[')).equals(getName())) {
iter.remove();
}
}
}
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
fail("Unexpected InterruptedException");
}
if (i > 0) {
@@ -703,14 +703,14 @@ public class LRUMapTest<K, V> extends Ab
};
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.start();
thread.wait();
}
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.notifyAll();
}
@@ -718,10 +718,10 @@ public class LRUMapTest<K, V> extends Ab
Thread.sleep(1000);
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
thread.interrupt();
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.join();
}
@@ -739,7 +739,7 @@ public class LRUMapTest<K, V> extends Ab
final Map<Throwable, String> exceptions = new HashMap<Throwable, String>();
final ThreadGroup tg = new ThreadGroup(getName()) {
@Override
- public void uncaughtException(Thread t, Throwable e) {
+ public void uncaughtException(final Thread t, final Throwable e) {
exceptions.put(e, t.getName());
super.uncaughtException(t, e);
}
@@ -759,20 +759,20 @@ public class LRUMapTest<K, V> extends Ab
notifyAll();
wait();
}
- Thread thread = Thread.currentThread();
+ final Thread thread = Thread.currentThread();
while (i < 1000 && !interrupted()) {
synchronized (map) {
map.put(thread.getName() + "[" + ++i + "]", thread);
}
}
synchronized (map) {
- for (Iterator<Thread> iter = map.values().iterator(); iter.hasNext();) {
+ for (final Iterator<Thread> iter = map.values().iterator(); iter.hasNext();) {
if (iter.next() == this) {
iter.remove();
}
}
}
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
fail("Unexpected InterruptedException");
}
if (i > 0) {
@@ -785,14 +785,14 @@ public class LRUMapTest<K, V> extends Ab
};
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.start();
thread.wait();
}
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.notifyAll();
}
@@ -800,10 +800,10 @@ public class LRUMapTest<K, V> extends Ab
Thread.sleep(1000);
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
thread.interrupt();
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
synchronized (thread) {
thread.join();
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LazyMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LazyMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LazyMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LazyMapTest.java Mon Jan 7 17:15:14 2013
@@ -40,7 +40,7 @@ public class LazyMapTest<K, V> extends A
private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
- public LazyMapTest(String testName) {
+ public LazyMapTest(final String testName) {
super(testName);
}
@@ -59,30 +59,30 @@ public class LazyMapTest<K, V> extends A
public void mapGetWithFactory() {
Map<Integer, Number> map = lazyMap(new HashMap<Integer,Number>(), oneFactory);
assertEquals(0, map.size());
- Number i1 = map.get("Five");
+ final Number i1 = map.get("Five");
assertEquals(1, i1);
assertEquals(1, map.size());
- Number i2 = map.get(new String(new char[] {'F','i','v','e'}));
+ final Number i2 = map.get(new String(new char[] {'F','i','v','e'}));
assertEquals(1, i2);
assertEquals(1, map.size());
assertSame(i1, i2);
map = lazyMap(new HashMap<Integer,Number>(), FactoryUtils.<Long>nullFactory());
- Object o = map.get("Five");
+ final Object o = map.get("Five");
assertEquals(null,o);
assertEquals(1, map.size());
}
@Test
public void mapGetWithTransformer() {
- Transformer<Number, Integer> intConverter = new Transformer<Number, Integer>(){
- public Integer transform(Number input) {
+ final Transformer<Number, Integer> intConverter = new Transformer<Number, Integer>(){
+ public Integer transform(final Number input) {
return input.intValue();
}
};
- Map<Long, Number> map = lazyMap(new HashMap<Long,Number>(), intConverter );
+ final Map<Long, Number> map = lazyMap(new HashMap<Long,Number>(), intConverter );
assertEquals(0, map.size());
- Number i1 = map.get(123L);
+ final Number i1 = map.get(123L);
assertEquals(123, i1);
assertEquals(1, map.size());
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LazySortedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LazySortedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LazySortedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LazySortedMapTest.java Mon Jan 7 17:15:14 2013
@@ -43,7 +43,7 @@ public class LazySortedMapTest<K, V> ext
private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);
- public LazySortedMapTest(String testName) {
+ public LazySortedMapTest(final String testName) {
super(testName);
}
@@ -74,12 +74,12 @@ public class LazySortedMapTest<K, V> ext
public void mapGet() {
Map<Integer, Number> map = lazySortedMap(new TreeMap<Integer,Number>(), oneFactory);
assertEquals(0, map.size());
- Number i1 = map.get(5);
+ final Number i1 = map.get(5);
assertEquals(1, i1);
assertEquals(1, map.size());
map = lazySortedMap(new TreeMap<Integer,Number>(), FactoryUtils.<Number>nullFactory());
- Number o = map.get(5);
+ final Number o = map.get(5);
assertEquals(null,o);
assertEquals(1, map.size());
@@ -87,7 +87,7 @@ public class LazySortedMapTest<K, V> ext
//-----------------------------------------------------------------------
public void testSortOrder() {
- SortedMap<String, Number> map = lazySortedMap(new TreeMap<String,Number>(), oneFactory);
+ final SortedMap<String, Number> map = lazySortedMap(new TreeMap<String,Number>(), oneFactory);
map.put("A", 5);
map.get("B"); // Entry with value "One" created
map.put("C", 8);
@@ -100,25 +100,25 @@ public class LazySortedMapTest<K, V> ext
assertEquals("Last key in submap should be B",
"B", map.subMap("A","C").lastKey());
- Comparator<?> c = map.comparator();
+ final Comparator<?> c = map.comparator();
assertTrue("natural order, so comparator should be null",
c == null);
}
public void testTransformerDecorate() {
- Transformer<Object, Integer> transformer = TransformerUtils.asTransformer(oneFactory);
+ final Transformer<Object, Integer> transformer = TransformerUtils.asTransformer(oneFactory);
SortedMap<Integer, Number> map = lazySortedMap(new TreeMap<Integer, Number>(), transformer);
assertTrue(map instanceof LazySortedMap);
try {
map = lazySortedMap(new TreeMap<Integer, Number>(), (Transformer<Integer, Number>) null);
fail("Expecting IllegalArgumentException for null transformer");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
map = lazySortedMap((SortedMap<Integer,Number>) null, transformer);
fail("Expecting IllegalArgumentException for null map");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LinkedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LinkedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LinkedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LinkedMapTest.java Mon Jan 7 17:15:14 2013
@@ -37,7 +37,7 @@ import org.apache.commons.collections.li
*/
public class LinkedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
- public LinkedMapTest(String testName) {
+ public LinkedMapTest(final String testName) {
super(testName);
}
@@ -72,8 +72,8 @@ public class LinkedMapTest<K, V> extends
resetFull();
ordered = getMap();
- List<K> list = new ArrayList<K>(ordered.keySet());
- ResettableIterator<K> it = (ResettableIterator<K>) ordered.mapIterator();
+ final List<K> list = new ArrayList<K>(ordered.keySet());
+ final ResettableIterator<K> it = (ResettableIterator<K>) ordered.mapIterator();
assertSame(list.get(0), it.next());
assertSame(list.get(1), it.next());
it.reset();
@@ -85,8 +85,8 @@ public class LinkedMapTest<K, V> extends
if (isPutAddSupported() == false || isPutChangeSupported() == false) {
return;
}
- K[] keys = getSampleKeys();
- V[] values = getSampleValues();
+ final K[] keys = getSampleKeys();
+ final V[] values = getSampleValues();
Iterator<K> keyIter;
Iterator<V> valueIter;
@@ -134,22 +134,22 @@ public class LinkedMapTest<K, V> extends
LinkedMap<K, V> lm = getMap();
try {
lm.get(0);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lm.get(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lm = getMap();
try {
lm.get(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lm.get(lm.size());
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
int i = 0;
- for (MapIterator<K, V> it = lm.mapIterator(); it.hasNext(); i++) {
+ for (final MapIterator<K, V> it = lm.mapIterator(); it.hasNext(); i++) {
assertSame(it.next(), lm.get(i));
}
}
@@ -159,22 +159,22 @@ public class LinkedMapTest<K, V> extends
LinkedMap<K, V> lm = getMap();
try {
lm.getValue(0);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lm.getValue(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lm = getMap();
try {
lm.getValue(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lm.getValue(lm.size());
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
int i = 0;
- for (MapIterator<K, V> it = lm.mapIterator(); it.hasNext(); i++) {
+ for (final MapIterator<K, V> it = lm.mapIterator(); it.hasNext(); i++) {
it.next();
assertSame(it.getValue(), lm.getValue(i));
}
@@ -187,8 +187,8 @@ public class LinkedMapTest<K, V> extends
resetFull();
lm = getMap();
- List<K> list = new ArrayList<K>();
- for (MapIterator<K, V> it = lm.mapIterator(); it.hasNext();) {
+ final List<K> list = new ArrayList<K>();
+ for (final MapIterator<K, V> it = lm.mapIterator(); it.hasNext();) {
list.add(it.next());
}
for (int i = 0; i < list.size(); i++) {
@@ -201,27 +201,27 @@ public class LinkedMapTest<K, V> extends
LinkedMap<K, V> lm = getMap();
try {
lm.remove(0);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lm.remove(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lm = getMap();
try {
lm.remove(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lm.remove(lm.size());
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
- List<K> list = new ArrayList<K>();
- for (MapIterator<K, V> it = lm.mapIterator(); it.hasNext();) {
+ final List<K> list = new ArrayList<K>();
+ for (final MapIterator<K, V> it = lm.mapIterator(); it.hasNext();) {
list.add(it.next());
}
for (int i = 0; i < list.size(); i++) {
- Object key = list.get(i);
- Object value = lm.get(key);
+ final Object key = list.get(i);
+ final Object value = lm.get(key);
assertEquals(value, lm.remove(i));
list.remove(i);
assertEquals(false, lm.containsKey(key));
@@ -276,9 +276,9 @@ public class LinkedMapTest<K, V> extends
@SuppressWarnings("unchecked")
public void testClone() {
- LinkedMap<K, V> map = new LinkedMap<K, V>(10);
+ final LinkedMap<K, V> map = new LinkedMap<K, V>(10);
map.put((K) "1", (V) "1");
- Map<K, V> cloned = map.clone();
+ final Map<K, V> cloned = map.clone();
assertEquals(map.size(), cloned.size());
assertSame(map.get("1"), cloned.get("1"));
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ListOrderedMap2Test.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ListOrderedMap2Test.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ListOrderedMap2Test.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ListOrderedMap2Test.java Mon Jan 7 17:15:14 2013
@@ -36,7 +36,7 @@ import org.apache.commons.collections.li
*/
public class ListOrderedMap2Test<K, V> extends AbstractOrderedMapTest<K, V> {
- public ListOrderedMap2Test(String testName) {
+ public ListOrderedMap2Test(final String testName) {
super(testName);
}
@@ -63,22 +63,22 @@ public class ListOrderedMap2Test<K, V> e
ListOrderedMap<K, V> lom = getMap();
try {
lom.get(0);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.get(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lom = getMap();
try {
lom.get(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.get(lom.size());
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
int i = 0;
- for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
+ for (final MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
assertSame(it.next(), lom.get(i));
}
}
@@ -88,22 +88,22 @@ public class ListOrderedMap2Test<K, V> e
ListOrderedMap<K, V> lom = getMap();
try {
lom.getValue(0);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.getValue(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lom = getMap();
try {
lom.getValue(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.getValue(lom.size());
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
int i = 0;
- for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
+ for (final MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
it.next();
assertSame(it.getValue(), lom.getValue(i));
}
@@ -116,8 +116,8 @@ public class ListOrderedMap2Test<K, V> e
resetFull();
lom = getMap();
- List<K> list = new ArrayList<K>();
- for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
+ final List<K> list = new ArrayList<K>();
+ for (final MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
list.add(it.next());
}
for (int i = 0; i < list.size(); i++) {
@@ -130,27 +130,27 @@ public class ListOrderedMap2Test<K, V> e
ListOrderedMap<K, V> lom = getMap();
try {
lom.remove(0);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.remove(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lom = getMap();
try {
lom.remove(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.remove(lom.size());
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
- List<K> list = new ArrayList<K>();
- for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
+ final List<K> list = new ArrayList<K>();
+ for (final MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
list.add(it.next());
}
for (int i = 0; i < list.size(); i++) {
- Object key = list.get(i);
- Object value = lom.get(key);
+ final Object key = list.get(i);
+ final Object value = lom.get(key);
assertEquals(value, lom.remove(i));
list.remove(i);
assertEquals(false, lom.containsKey(key));
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ListOrderedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ListOrderedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ListOrderedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ListOrderedMapTest.java Mon Jan 7 17:15:14 2013
@@ -40,7 +40,7 @@ import org.apache.commons.collections.li
*/
public class ListOrderedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
- public ListOrderedMapTest(String testName) {
+ public ListOrderedMapTest(final String testName) {
super(testName);
}
@@ -67,22 +67,22 @@ public class ListOrderedMapTest<K, V> ex
ListOrderedMap<K, V> lom = getMap();
try {
lom.get(0);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.get(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lom = getMap();
try {
lom.get(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.get(lom.size());
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
int i = 0;
- for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
+ for (final MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
assertSame(it.next(), lom.get(i));
}
}
@@ -92,22 +92,22 @@ public class ListOrderedMapTest<K, V> ex
ListOrderedMap<K, V> lom = getMap();
try {
lom.getValue(0);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.getValue(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lom = getMap();
try {
lom.getValue(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.getValue(lom.size());
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
int i = 0;
- for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
+ for (final MapIterator<K, V> it = lom.mapIterator(); it.hasNext(); i++) {
it.next();
assertSame(it.getValue(), lom.getValue(i));
}
@@ -120,8 +120,8 @@ public class ListOrderedMapTest<K, V> ex
resetFull();
lom = getMap();
- List<K> list = new ArrayList<K>();
- for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
+ final List<K> list = new ArrayList<K>();
+ for (final MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
list.add(it.next());
}
for (int i = 0; i < list.size(); i++) {
@@ -135,23 +135,23 @@ public class ListOrderedMapTest<K, V> ex
ListOrderedMap<K, V> lom = getMap();
try {
lom.setValue(0, (V) "");
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.setValue(-1, (V) "");
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lom = getMap();
try {
lom.setValue(-1, (V) "");
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.setValue(lom.size(), (V) "");
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
for (int i = 0; i < lom.size(); i++) {
- V value = lom.getValue(i);
- Object input = new Integer(i);
+ final V value = lom.getValue(i);
+ final Object input = new Integer(i);
assertEquals(value, lom.setValue(i, (V) input));
assertEquals(input, lom.getValue(i));
}
@@ -162,27 +162,27 @@ public class ListOrderedMapTest<K, V> ex
ListOrderedMap<K, V> lom = getMap();
try {
lom.remove(0);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.remove(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
resetFull();
lom = getMap();
try {
lom.remove(-1);
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.remove(lom.size());
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
- List<K> list = new ArrayList<K>();
- for (MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
+ final List<K> list = new ArrayList<K>();
+ for (final MapIterator<K, V> it = lom.mapIterator(); it.hasNext();) {
list.add(it.next());
}
for (int i = 0; i < list.size(); i++) {
- Object key = list.get(i);
- Object value = lom.get(key);
+ final Object key = list.get(i);
+ final Object value = lom.get(key);
assertEquals(value, lom.remove(i));
list.remove(i);
assertEquals(false, lom.containsKey(key));
@@ -197,11 +197,11 @@ public class ListOrderedMapTest<K, V> ex
try {
lom.put(1, (K) "testInsert1", (V) "testInsert1v");
fail("should not be able to insert at pos 1 in empty Map");
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
try {
lom.put(-1, (K) "testInsert-1", (V) "testInsert-1v");
fail("should not be able to insert at pos -1 in empty Map");
- } catch (IndexOutOfBoundsException ex) {}
+ } catch (final IndexOutOfBoundsException ex) {}
// put where key doesn't exist
lom.put(0, (K) "testInsert1", (V) "testInsert1v");
@@ -225,7 +225,7 @@ public class ListOrderedMapTest<K, V> ex
// put in a full map
resetFull();
lom = getMap();
- ListOrderedMap<K, V> lom2 = new ListOrderedMap<K, V>();
+ final ListOrderedMap<K, V> lom2 = new ListOrderedMap<K, V>();
lom2.putAll(lom);
lom2.put(0, (K) "testInsert0", (V) "testInsert0v");
@@ -235,10 +235,10 @@ public class ListOrderedMapTest<K, V> ex
}
// put where key does exist
- Integer i1 = new Integer(1);
- Integer i1b = new Integer(1);
- Integer i2 = new Integer(2);
- Integer i3 = new Integer(3);
+ final Integer i1 = new Integer(1);
+ final Integer i1b = new Integer(1);
+ final Integer i2 = new Integer(2);
+ final Integer i3 = new Integer(3);
resetEmpty();
lom = getMap();
@@ -308,7 +308,7 @@ public class ListOrderedMapTest<K, V> ex
public void testPutAllWithIndex() {
resetEmpty();
- ListOrderedMap<String, String> lom = (ListOrderedMap<String, String>) map;
+ final ListOrderedMap<String, String> lom = (ListOrderedMap<String, String>) map;
// Create Initial Data
lom.put("testInsert0", "testInsert0v");
@@ -319,7 +319,7 @@ public class ListOrderedMapTest<K, V> ex
assertEquals("testInsert2v", lom.getValue(2));
// Create New Test Map and Add using putAll(int, Object, Object)
- Map<String, String> values = new ListOrderedMap<String, String>();
+ final Map<String, String> values = new ListOrderedMap<String, String>();
values.put("NewInsert0", "NewInsert0v");
values.put("NewInsert1", "NewInsert1v");
lom.putAll(1, values);
@@ -335,21 +335,21 @@ public class ListOrderedMapTest<K, V> ex
public void testPutAllWithIndexBug441() {
// see COLLECTIONS-441
resetEmpty();
- ListOrderedMap<K, V> lom = getMap();
+ final ListOrderedMap<K, V> lom = getMap();
- int size = 5;
+ final int size = 5;
for (int i = 0; i < size; i++) {
lom.put((K) Integer.valueOf(i), (V) Boolean.valueOf(true));
}
- Map<K, V> map = new TreeMap<K, V>();
+ final Map<K, V> map = new TreeMap<K, V>();
for (int i = 0; i < size; i++) {
map.put((K) Integer.valueOf(i), (V) Boolean.valueOf(false));
}
lom.putAll(3, map);
- List<K> orderedList = lom.asList();
+ final List<K> orderedList = lom.asList();
for (int i = 0; i < size; i++) {
assertEquals(i, orderedList.get(i));
}
@@ -358,9 +358,9 @@ public class ListOrderedMapTest<K, V> ex
//-----------------------------------------------------------------------
public void testValueList_getByIndex() {
resetFull();
- ListOrderedMap<K, V> lom = getMap();
+ final ListOrderedMap<K, V> lom = getMap();
for (int i = 0; i < lom.size(); i++) {
- V expected = lom.getValue(i);
+ final V expected = lom.getValue(i);
assertEquals(expected, lom.valueList().get(i));
}
}
@@ -368,10 +368,10 @@ public class ListOrderedMapTest<K, V> ex
@SuppressWarnings("unchecked")
public void testValueList_setByIndex() {
resetFull();
- ListOrderedMap<K, V> lom = getMap();
+ final ListOrderedMap<K, V> lom = getMap();
for (int i = 0; i < lom.size(); i++) {
- Object input = new Integer(i);
- V expected = lom.getValue(i);
+ final Object input = new Integer(i);
+ final V expected = lom.getValue(i);
assertEquals(expected, lom.valueList().set(i, (V) input));
assertEquals(input, lom.getValue(i));
assertEquals(input, lom.valueList().get(i));
@@ -380,9 +380,9 @@ public class ListOrderedMapTest<K, V> ex
public void testValueList_removeByIndex() {
resetFull();
- ListOrderedMap<K, V> lom = getMap();
+ final ListOrderedMap<K, V> lom = getMap();
while (lom.size() > 1) {
- V expected = lom.getValue(1);
+ final V expected = lom.getValue(1);
assertEquals(expected, lom.valueList().remove(1));
}
}