From 12d9e8743dc8290838fc74f650b16c27f7054111 Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Mon, 7 Jan 2013 16:51:34 +0000 Subject: [PATCH] Remove unnecessary casts. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1429892 13f79535-47bb-0310-9956-ffa450edef68 --- .../collections/trie/ByteArrayKeyAnalyzer.java | 4 ++-- .../collections/trie/CharArrayKeyAnalyzer.java | 4 ++-- .../collections/trie/StringKeyAnalyzer.java | 4 ++-- .../commons/collections/CollectionUtilsTest.java | 2 +- .../collection/IndexedCollectionTest.java | 2 +- .../commons/collections/map/MultiValueMapTest.java | 14 +++++++------- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/apache/commons/collections/trie/ByteArrayKeyAnalyzer.java b/src/main/java/org/apache/commons/collections/trie/ByteArrayKeyAnalyzer.java index 30ac4b75a..72bd8ff16 100644 --- a/src/main/java/org/apache/commons/collections/trie/ByteArrayKeyAnalyzer.java +++ b/src/main/java/org/apache/commons/collections/trie/ByteArrayKeyAnalyzer.java @@ -105,8 +105,8 @@ public class ByteArrayKeyAnalyzer extends AbstractKeyAnalyzer { return false; } - int index = (int)(keyBitIndex / LENGTH); - int bit = (int)(keyBitIndex % LENGTH); + int index = keyBitIndex / LENGTH; + int bit = keyBitIndex % LENGTH; return (key[index] & mask(bit)) != 0; } diff --git a/src/main/java/org/apache/commons/collections/trie/CharArrayKeyAnalyzer.java b/src/main/java/org/apache/commons/collections/trie/CharArrayKeyAnalyzer.java index c0f5af05b..07cfd7937 100644 --- a/src/main/java/org/apache/commons/collections/trie/CharArrayKeyAnalyzer.java +++ b/src/main/java/org/apache/commons/collections/trie/CharArrayKeyAnalyzer.java @@ -131,8 +131,8 @@ public class CharArrayKeyAnalyzer extends AbstractKeyAnalyzer { return false; } - int index = (int)(bitIndex / LENGTH); - int bit = (int)(bitIndex % LENGTH); + int index = bitIndex / LENGTH; + int bit = bitIndex % LENGTH; return (key[index] & mask(bit)) != 0; } diff --git a/src/main/java/org/apache/commons/collections/trie/StringKeyAnalyzer.java b/src/main/java/org/apache/commons/collections/trie/StringKeyAnalyzer.java index 6b0ea4254..3272d2c42 100644 --- a/src/main/java/org/apache/commons/collections/trie/StringKeyAnalyzer.java +++ b/src/main/java/org/apache/commons/collections/trie/StringKeyAnalyzer.java @@ -131,8 +131,8 @@ public class StringKeyAnalyzer extends AbstractKeyAnalyzer { return false; } - int index = (int)(bitIndex / LENGTH); - int bit = (int)(bitIndex % LENGTH); + int index = bitIndex / LENGTH; + int bit = bitIndex % LENGTH; return (key.charAt(index) & mask(bit)) != 0; } diff --git a/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java index 1297398bd..ffe1b439f 100644 --- a/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java +++ b/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java @@ -914,7 +914,7 @@ public class CollectionUtilsTest extends MockTestCase { ints.add(3); Iterable iterable = ints; assertTrue(CollectionUtils.filter(iterable, EQUALS_TWO)); - assertEquals(1, (int) ints.size()); + assertEquals(1, ints.size()); assertEquals(2, (int) ints.get(0)); } diff --git a/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java b/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java index aa25028d0..44a99e580 100644 --- a/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java +++ b/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java @@ -68,7 +68,7 @@ public class IndexedCollectionTest extends AbstractCollectionTest { @Override public String[] getFullElements() { - return (String[]) new String[] { "1", "3", "5", "7", "2", "4", "6" }; + return new String[] { "1", "3", "5", "7", "2", "4", "6" }; } @Override diff --git a/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java b/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java index ad6400027..99896e99e 100644 --- a/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java +++ b/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java @@ -78,13 +78,13 @@ public class MultiValueMapTest extends AbstractObjectTest { @SuppressWarnings("unchecked") public void testKeyContainsValue() { final MultiValueMap map = createTestMap(HashSet.class); - assertTrue(map.containsValue((K) "one", "uno")); - assertTrue(map.containsValue((K) "one", "un")); - assertTrue(map.containsValue((K) "two", "dos")); - assertTrue(map.containsValue((K) "two", "deux")); - assertTrue(map.containsValue((K) "three", "tres")); - assertTrue(map.containsValue((K) "three", "trois")); - assertFalse(map.containsValue((K) "four", "quatro")); + assertTrue(map.containsValue("one", "uno")); + assertTrue(map.containsValue("one", "un")); + assertTrue(map.containsValue("two", "dos")); + assertTrue(map.containsValue("two", "deux")); + assertTrue(map.containsValue("three", "tres")); + assertTrue(map.containsValue("three", "trois")); + assertFalse(map.containsValue("four", "quatro")); } @SuppressWarnings("unchecked")