Remove unnecessary casts
This commit is contained in:
parent
b9e2a97758
commit
1bcfa1cc87
|
@ -245,7 +245,7 @@ public class BagUtils {
|
|||
*/
|
||||
@SuppressWarnings("unchecked") // OK, empty bag is compatible with any type
|
||||
public static <E> Bag<E> emptyBag() {
|
||||
return (Bag<E>) EMPTY_BAG;
|
||||
return EMPTY_BAG;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -102,6 +102,6 @@ public class QueueUtils {
|
|||
*/
|
||||
@SuppressWarnings("unchecked") // OK, empty queue is compatible with any type
|
||||
public static <E> Queue<E> emptyQueue() {
|
||||
return (Queue<E>) EMPTY_QUEUE;
|
||||
return EMPTY_QUEUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ConstantFactory<T> implements Factory<T>, Serializable {
|
|||
@SuppressWarnings("unchecked") // The null factory works for all object types
|
||||
public static <T> Factory<T> constantFactory(final T constantToReturn) {
|
||||
if (constantToReturn == null) {
|
||||
return (Factory<T>) NULL_INSTANCE;
|
||||
return NULL_INSTANCE;
|
||||
}
|
||||
return new ConstantFactory<>(constantToReturn);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ConstantTransformer<I, O> implements Transformer<I, O>, Serializabl
|
|||
*/
|
||||
@SuppressWarnings("unchecked") // The null transformer works for all object types
|
||||
public static <I, O> Transformer<I, O> nullTransformer() {
|
||||
return (Transformer<I, O>) NULL_INSTANCE;
|
||||
return NULL_INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,7 +48,7 @@ public class DefaultEquator<T> implements Equator<T>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked") // the static instance works for all types
|
||||
public static <T> DefaultEquator<T> defaultEquator() {
|
||||
return (DefaultEquator<T>) DefaultEquator.INSTANCE;
|
||||
return DefaultEquator.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class ExceptionClosure<E> implements Closure<E>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked") // the static instance works for all types
|
||||
public static <E> Closure<E> exceptionClosure() {
|
||||
return (Closure<E>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class ExceptionFactory<T> implements Factory<T>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked") // the static instance works for all types
|
||||
public static <T> Factory<T> exceptionFactory() {
|
||||
return (Factory<T>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class ExceptionPredicate<T> implements Predicate<T>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked") // the static instance works for all types
|
||||
public static <T> Predicate<T> exceptionPredicate() {
|
||||
return (Predicate<T>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,7 +45,7 @@ public final class ExceptionTransformer<I, O> implements Transformer<I, O>, Seri
|
|||
*/
|
||||
@SuppressWarnings("unchecked") // the static instance works for all types
|
||||
public static <I, O> Transformer<I, O> exceptionTransformer() {
|
||||
return (Transformer<I, O>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class FalsePredicate<T> implements Predicate<T>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked") // the static instance works for all types
|
||||
public static <T> Predicate<T> falsePredicate() {
|
||||
return (Predicate<T>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class NOPClosure<E> implements Closure<E>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E> Closure<E> nopClosure() {
|
||||
return (Closure<E>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public class NOPTransformer<T> implements Transformer<T, T>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Transformer<T, T> nopTransformer() {
|
||||
return (Transformer<T, T>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class NotNullPredicate<T> implements Predicate<T>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Predicate<T> notNullPredicate() {
|
||||
return (Predicate<T>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class NullPredicate<T> implements Predicate<T>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Predicate<T> nullPredicate() {
|
||||
return (Predicate<T>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class TruePredicate<T> implements Predicate<T>, Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Predicate<T> truePredicate() {
|
||||
return (Predicate<T>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,7 +52,7 @@ public class EmptyIterator<E> extends AbstractEmptyIterator<E> implements Resett
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
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")
|
||||
public static <E> Iterator<E> emptyIterator() {
|
||||
return (Iterator<E>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ public class EmptyListIterator<E> extends AbstractEmptyIterator<E> implements
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
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")
|
||||
public static <E> ListIterator<E> emptyListIterator() {
|
||||
return (ListIterator<E>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ public class EmptyMapIterator<K, V> extends AbstractEmptyMapIterator<K, V> imple
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <K, V> MapIterator<K, V> emptyMapIterator() {
|
||||
return (MapIterator<K, V>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@ public class EmptyOrderedIterator<E> extends AbstractEmptyIterator<E>
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E> OrderedIterator<E> emptyOrderedIterator() {
|
||||
return (OrderedIterator<E>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ public class EmptyOrderedMapIterator<K, V> extends AbstractEmptyMapIterator<K, V
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <K, V> OrderedMapIterator<K, V> emptyOrderedMapIterator() {
|
||||
return (OrderedMapIterator<K, V>) INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue