Remove unnecessary type casts.
This commit is contained in:
parent
1d26ffda93
commit
9675e6c794
|
@ -115,7 +115,7 @@ public class DynamicHasher implements Hasher {
|
|||
buffer++;
|
||||
}
|
||||
return (int) Math.floorMod(function.apply(buffers.get(buffer), funcCount++),
|
||||
(long) shape.getNumberOfBits());
|
||||
shape.getNumberOfBits());
|
||||
}
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
|
|
@ -1410,7 +1410,7 @@ public class IteratorUtilsTest {
|
|||
@Test(expected = NullPointerException.class)
|
||||
public void testUnmodifiableMapIterator() {
|
||||
Set<?> set = new LinkedHashSet<>();
|
||||
final MapIterator ie = (MapIterator) new EntrySetToMapIteratorAdapter(set);
|
||||
final MapIterator ie = new EntrySetToMapIteratorAdapter(set);
|
||||
assertTrue("create instance fail", IteratorUtils.unmodifiableMapIterator(ie) instanceof MapIterator);
|
||||
IteratorUtils.unmodifiableMapIterator(null);
|
||||
|
||||
|
|
|
@ -982,7 +982,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
|
|||
final int size = getCollection().size();
|
||||
final int targetCount = Collections.frequency(elements, target);
|
||||
|
||||
final Predicate<E> filter = e -> target.equals((E) e);
|
||||
final Predicate<E> filter = e -> target.equals(e);
|
||||
|
||||
assertTrue("Full collection removeIf should work", getCollection().removeIf(filter));
|
||||
getConfirmed().removeIf(filter);
|
||||
|
|
|
@ -354,9 +354,9 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
Map.Entry<K, V> mapEntry3 = it.next();
|
||||
it.remove();
|
||||
assertEquals(2, map.size());
|
||||
assertEquals("one", map.get((K) "A"));
|
||||
assertEquals("two", map.get((K) "B"));
|
||||
assertEquals(null, map.get((K) "C"));
|
||||
assertEquals("one", map.get("A"));
|
||||
assertEquals("two", map.get("B"));
|
||||
assertEquals(null, map.get("C"));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -688,8 +688,8 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
|||
}
|
||||
assertEquals("{A=[X, Y, Z], B=[U, V, W]}", map.toString());
|
||||
|
||||
map.remove((K) "A");
|
||||
map.remove((K) "B");
|
||||
map.remove("A");
|
||||
map.remove("B");
|
||||
assertEquals("{}", map.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ public class UnmodifiableMultiValuedMapTest<K, V> extends AbstractMultiValuedMap
|
|||
public void testRemoveException() {
|
||||
final MultiValuedMap<K, V> map = makeFullMap();
|
||||
try {
|
||||
map.remove((K) "one");
|
||||
map.remove("one");
|
||||
fail();
|
||||
} catch (final UnsupportedOperationException e) {
|
||||
// expected, not support remove() method
|
||||
|
@ -116,7 +116,7 @@ public class UnmodifiableMultiValuedMapTest<K, V> extends AbstractMultiValuedMap
|
|||
public void testRemoveMappingException() {
|
||||
final MultiValuedMap<K, V> map = makeFullMap();
|
||||
try {
|
||||
map.removeMapping((K) "one", (V) "uno");
|
||||
map.removeMapping("one", "uno");
|
||||
fail();
|
||||
} catch (final UnsupportedOperationException e) {
|
||||
// expected, not support removeMapping() method
|
||||
|
|
|
@ -472,9 +472,9 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
|
|||
multiset.add((T) "A");
|
||||
final MultiSet.Entry<T> entry = multiset.entrySet().iterator().next();
|
||||
assertEquals(2, entry.getCount());
|
||||
multiset.remove((T) "A");
|
||||
multiset.remove("A");
|
||||
assertEquals(1, entry.getCount());
|
||||
multiset.remove((T) "A");
|
||||
multiset.remove("A");
|
||||
assertEquals(0, entry.getCount());
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ public class UnmodifiableMultiSetTest<E> extends AbstractMultiSetTest<E> {
|
|||
final MultiSet<E> multiset = makeFullCollection();
|
||||
final MultiSet<E> unmodifiableMultiSet = UnmodifiableMultiSet.unmodifiableMultiSet(multiset);
|
||||
try {
|
||||
unmodifiableMultiSet.remove( (E)"One",1);
|
||||
unmodifiableMultiSet.remove( "One",1);
|
||||
fail();
|
||||
} catch (final UnsupportedOperationException ex) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue