Remove unnecessary casts

This commit is contained in:
Gary Gregory 2017-10-11 16:39:20 -06:00
parent b9e2a97758
commit 1bcfa1cc87
20 changed files with 22 additions and 22 deletions

View File

@ -245,7 +245,7 @@ public class BagUtils {
*/ */
@SuppressWarnings("unchecked") // OK, empty bag is compatible with any type @SuppressWarnings("unchecked") // OK, empty bag is compatible with any type
public static <E> Bag<E> emptyBag() { public static <E> Bag<E> emptyBag() {
return (Bag<E>) EMPTY_BAG; return EMPTY_BAG;
} }
/** /**

View File

@ -102,6 +102,6 @@ public class QueueUtils {
*/ */
@SuppressWarnings("unchecked") // OK, empty queue is compatible with any type @SuppressWarnings("unchecked") // OK, empty queue is compatible with any type
public static <E> Queue<E> emptyQueue() { public static <E> Queue<E> emptyQueue() {
return (Queue<E>) EMPTY_QUEUE; return EMPTY_QUEUE;
} }
} }

View File

@ -51,7 +51,7 @@ public class ConstantFactory<T> implements Factory<T>, Serializable {
@SuppressWarnings("unchecked") // The null factory works for all object types @SuppressWarnings("unchecked") // The null factory works for all object types
public static <T> Factory<T> constantFactory(final T constantToReturn) { public static <T> Factory<T> constantFactory(final T constantToReturn) {
if (constantToReturn == null) { if (constantToReturn == null) {
return (Factory<T>) NULL_INSTANCE; return NULL_INSTANCE;
} }
return new ConstantFactory<>(constantToReturn); return new ConstantFactory<>(constantToReturn);
} }

View File

@ -50,7 +50,7 @@ public class ConstantTransformer<I, O> implements Transformer<I, O>, Serializabl
*/ */
@SuppressWarnings("unchecked") // The null transformer works for all object types @SuppressWarnings("unchecked") // The null transformer works for all object types
public static <I, O> Transformer<I, O> nullTransformer() { public static <I, O> Transformer<I, O> nullTransformer() {
return (Transformer<I, O>) NULL_INSTANCE; return NULL_INSTANCE;
} }
/** /**

View File

@ -48,7 +48,7 @@ public class DefaultEquator<T> implements Equator<T>, Serializable {
*/ */
@SuppressWarnings("unchecked") // the static instance works for all types @SuppressWarnings("unchecked") // the static instance works for all types
public static <T> DefaultEquator<T> defaultEquator() { public static <T> DefaultEquator<T> defaultEquator() {
return (DefaultEquator<T>) DefaultEquator.INSTANCE; return DefaultEquator.INSTANCE;
} }
/** /**

View File

@ -44,7 +44,7 @@ public final class ExceptionClosure<E> implements Closure<E>, Serializable {
*/ */
@SuppressWarnings("unchecked") // the static instance works for all types @SuppressWarnings("unchecked") // the static instance works for all types
public static <E> Closure<E> exceptionClosure() { public static <E> Closure<E> exceptionClosure() {
return (Closure<E>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -44,7 +44,7 @@ public final class ExceptionFactory<T> implements Factory<T>, Serializable {
*/ */
@SuppressWarnings("unchecked") // the static instance works for all types @SuppressWarnings("unchecked") // the static instance works for all types
public static <T> Factory<T> exceptionFactory() { public static <T> Factory<T> exceptionFactory() {
return (Factory<T>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -44,7 +44,7 @@ public final class ExceptionPredicate<T> implements Predicate<T>, Serializable {
*/ */
@SuppressWarnings("unchecked") // the static instance works for all types @SuppressWarnings("unchecked") // the static instance works for all types
public static <T> Predicate<T> exceptionPredicate() { public static <T> Predicate<T> exceptionPredicate() {
return (Predicate<T>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -45,7 +45,7 @@ public final class ExceptionTransformer<I, O> implements Transformer<I, O>, Seri
*/ */
@SuppressWarnings("unchecked") // the static instance works for all types @SuppressWarnings("unchecked") // the static instance works for all types
public static <I, O> Transformer<I, O> exceptionTransformer() { public static <I, O> Transformer<I, O> exceptionTransformer() {
return (Transformer<I, O>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -43,7 +43,7 @@ public final class FalsePredicate<T> implements Predicate<T>, Serializable {
*/ */
@SuppressWarnings("unchecked") // the static instance works for all types @SuppressWarnings("unchecked") // the static instance works for all types
public static <T> Predicate<T> falsePredicate() { public static <T> Predicate<T> falsePredicate() {
return (Predicate<T>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -43,7 +43,7 @@ public final class NOPClosure<E> implements Closure<E>, Serializable {
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <E> Closure<E> nopClosure() { public static <E> Closure<E> nopClosure() {
return (Closure<E>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -43,7 +43,7 @@ public class NOPTransformer<T> implements Transformer<T, T>, Serializable {
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> Transformer<T, T> nopTransformer() { public static <T> Transformer<T, T> nopTransformer() {
return (Transformer<T, T>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -43,7 +43,7 @@ public final class NotNullPredicate<T> implements Predicate<T>, Serializable {
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> Predicate<T> notNullPredicate() { public static <T> Predicate<T> notNullPredicate() {
return (Predicate<T>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -43,7 +43,7 @@ public final class NullPredicate<T> implements Predicate<T>, Serializable {
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> Predicate<T> nullPredicate() { public static <T> Predicate<T> nullPredicate() {
return (Predicate<T>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -43,7 +43,7 @@ public final class TruePredicate<T> implements Predicate<T>, Serializable {
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> Predicate<T> truePredicate() { public static <T> Predicate<T> truePredicate() {
return (Predicate<T>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -52,7 +52,7 @@ public class EmptyIterator<E> extends AbstractEmptyIterator<E> implements Resett
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <E> ResettableIterator<E> resettableEmptyIterator() { public static <E> ResettableIterator<E> resettableEmptyIterator() {
return (ResettableIterator<E>) RESETTABLE_INSTANCE; return RESETTABLE_INSTANCE;
} }
/** /**
@ -62,7 +62,7 @@ public class EmptyIterator<E> extends AbstractEmptyIterator<E> implements Resett
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <E> Iterator<E> emptyIterator() { public static <E> Iterator<E> emptyIterator() {
return (Iterator<E>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -53,7 +53,7 @@ public class EmptyListIterator<E> extends AbstractEmptyIterator<E> implements
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <E> ResettableListIterator<E> resettableEmptyListIterator() { public static <E> ResettableListIterator<E> resettableEmptyListIterator() {
return (ResettableListIterator<E>) RESETTABLE_INSTANCE; return RESETTABLE_INSTANCE;
} }
/** /**
@ -63,7 +63,7 @@ public class EmptyListIterator<E> extends AbstractEmptyIterator<E> implements
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <E> ListIterator<E> emptyListIterator() { public static <E> ListIterator<E> emptyListIterator() {
return (ListIterator<E>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -42,7 +42,7 @@ public class EmptyMapIterator<K, V> extends AbstractEmptyMapIterator<K, V> imple
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <K, V> MapIterator<K, V> emptyMapIterator() { public static <K, V> MapIterator<K, V> emptyMapIterator() {
return (MapIterator<K, V>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -41,7 +41,7 @@ public class EmptyOrderedIterator<E> extends AbstractEmptyIterator<E>
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <E> OrderedIterator<E> emptyOrderedIterator() { public static <E> OrderedIterator<E> emptyOrderedIterator() {
return (OrderedIterator<E>) INSTANCE; return INSTANCE;
} }
/** /**

View File

@ -42,7 +42,7 @@ public class EmptyOrderedMapIterator<K, V> extends AbstractEmptyMapIterator<K, V
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <K, V> OrderedMapIterator<K, V> emptyOrderedMapIterator() { public static <K, V> OrderedMapIterator<K, V> emptyOrderedMapIterator() {
return (OrderedMapIterator<K, V>) INSTANCE; return INSTANCE;
} }
/** /**