No cast needed

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1026193 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-10-22 01:29:03 +00:00
parent 8fc1425e84
commit f46321a44d
3 changed files with 10 additions and 10 deletions

View File

@ -76,7 +76,7 @@ public class TestFixedOrderComparator extends TestCase {
for (int i = 0; i < topCities.length; i++) {
comparator.add(topCities[i]);
}
String[] keys = (String[]) topCities.clone();
String[] keys = topCities.clone();
assertComparatorYieldsOrder(keys, comparator);
}
@ -84,8 +84,8 @@ public class TestFixedOrderComparator extends TestCase {
* Tests that the array constructor compares items properly.
*/
public void testArrayConstructor() {
String[] keys = (String[]) topCities.clone();
String[] topCitiesForTest = (String[]) topCities.clone();
String[] keys = topCities.clone();
String[] topCitiesForTest = topCities.clone();
FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCitiesForTest);
assertComparatorYieldsOrder(keys, comparator);
// test that changing input after constructor has no effect
@ -97,7 +97,7 @@ public class TestFixedOrderComparator extends TestCase {
* Tests the list constructor.
*/
public void testListConstructor() {
String[] keys = (String[]) topCities.clone();
String[] keys = topCities.clone();
List<String> topCitiesForTest = new LinkedList<String>(Arrays.asList(topCities));
FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCitiesForTest);
assertComparatorYieldsOrder(keys, comparator);

View File

@ -382,7 +382,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator<Object> {
}
Tree getTree(int index) {
return (Tree) trees.get(index);
return trees.get(index);
}
Iterator<Tree> treeIterator() {
@ -399,7 +399,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator<Object> {
}
Branch getBranch(int index) {
return (Branch) branches.get(index);
return branches.get(index);
}
Iterator<Branch> branchIterator() {
@ -416,7 +416,7 @@ public class TestObjectGraphIterator extends AbstractTestIterator<Object> {
}
Leaf getLeaf(int index) {
return (Leaf) leaves.get(index);
return leaves.get(index);
}
Iterator<Leaf> leafIterator() {

View File

@ -1400,7 +1400,7 @@ public class TestCursorableLinkedList<E> extends AbstractTestLinkedList<E> {
assertEquals("5", elts[4]);
assertEquals(5, elts.length);
String[] elts2 = (String[]) (list.toArray(new String[0]));
String[] elts2 = (list.toArray(new String[0]));
assertEquals("1", elts2[0]);
assertEquals("2", elts2[1]);
assertEquals("3", elts2[2]);
@ -1418,7 +1418,7 @@ public class TestCursorableLinkedList<E> extends AbstractTestLinkedList<E> {
assertEquals(5, elts3.length);
String[] elts4 = new String[3];
String[] elts4b = (String[]) (list.toArray(elts4));
String[] elts4b = (list.toArray(elts4));
assertTrue(elts4 != elts4b);
assertEquals("1", elts4b[0]);
assertEquals("2", elts4b[1]);
@ -1520,7 +1520,7 @@ public class TestCursorableLinkedList<E> extends AbstractTestLinkedList<E> {
list.add(prefix + bulk + ignored[i]);
list.add(prefix + bulk + bulk + ignored[i]);
}
return (String[]) list.toArray(new String[0]);
return list.toArray(new String[0]);
}
@Override