Replace explicit type with <>.
This commit is contained in:
parent
b228aea7f7
commit
de46d49f4e
|
@ -1189,7 +1189,7 @@ public class CollectionUtils {
|
|||
*/
|
||||
public static <I, O> Collection<O> collect(final Iterator<I> inputIterator,
|
||||
final Transformer<? super I, ? extends O> transformer) {
|
||||
return collect(inputIterator, transformer, new ArrayList<O>());
|
||||
return collect(inputIterator, transformer, new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1892,7 +1892,7 @@ public class CollectionUtils {
|
|||
final Transformer<E, EquatorWrapper<E>> transformer = input -> new EquatorWrapper<>(equator, input);
|
||||
|
||||
final Set<EquatorWrapper<E>> retainSet =
|
||||
collect(retain, transformer, new HashSet<EquatorWrapper<E>>());
|
||||
collect(retain, transformer, new HashSet<>());
|
||||
|
||||
final List<E> list = new ArrayList<>();
|
||||
for (final E element : collection) {
|
||||
|
@ -2031,7 +2031,7 @@ public class CollectionUtils {
|
|||
final Transformer<E, EquatorWrapper<E>> transformer = input -> new EquatorWrapper<>(equator, input);
|
||||
|
||||
final Set<EquatorWrapper<E>> removeSet =
|
||||
collect(remove, transformer, new HashSet<EquatorWrapper<E>>());
|
||||
collect(remove, transformer, new HashSet<>());
|
||||
|
||||
final List<E> list = new ArrayList<>();
|
||||
for (final E element : collection) {
|
||||
|
|
|
@ -596,7 +596,7 @@ public class ListUtils {
|
|||
*/
|
||||
public static <E> List<E> select(final Collection<? extends E> inputCollection,
|
||||
final Predicate<? super E> predicate) {
|
||||
return CollectionUtils.select(inputCollection, predicate, new ArrayList<E>(inputCollection.size()));
|
||||
return CollectionUtils.select(inputCollection, predicate, new ArrayList<>(inputCollection.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -616,7 +616,7 @@ public class ListUtils {
|
|||
*/
|
||||
public static <E> List<E> selectRejected(final Collection<? extends E> inputCollection,
|
||||
final Predicate<? super E> predicate) {
|
||||
return CollectionUtils.selectRejected(inputCollection, predicate, new ArrayList<E>(inputCollection.size()));
|
||||
return CollectionUtils.selectRejected(inputCollection, predicate, new ArrayList<>(inputCollection.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -167,7 +167,7 @@ public class MapUtils {
|
|||
* @throws NullPointerException if the stream is {@code null}
|
||||
*/
|
||||
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) {
|
||||
verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true);
|
||||
verbosePrintInternal(out, label, map, new ArrayDeque<>(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1967,7 +1967,7 @@ public class MapUtils {
|
|||
* @throws NullPointerException if the stream is {@code null}
|
||||
*/
|
||||
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) {
|
||||
verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false);
|
||||
verbosePrintInternal(out, label, map, new ArrayDeque<>(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -351,7 +351,7 @@ public class SetUtils {
|
|||
* @since 4.1
|
||||
*/
|
||||
public static <E> Set<E> newIdentityHashSet() {
|
||||
return Collections.newSetFromMap(new IdentityHashMap<E, Boolean>());
|
||||
return Collections.newSetFromMap(new IdentityHashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,7 +46,7 @@ public class HashBag<E> extends AbstractMapBag<E> implements Serializable {
|
|||
* Constructs an empty {@link HashBag}.
|
||||
*/
|
||||
public HashBag() {
|
||||
super(new HashMap<E, MutableInteger>());
|
||||
super(new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@ public class HashBag<E> extends AbstractMapBag<E> implements Serializable {
|
|||
*/
|
||||
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
super.doReadObject(new HashMap<E, MutableInteger>(), in);
|
||||
super.doReadObject(new HashMap<>(), in);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TreeBag<E> extends AbstractMapBag<E> implements SortedBag<E>, Seria
|
|||
* Constructs an empty {@link TreeBag}.
|
||||
*/
|
||||
public TreeBag() {
|
||||
super(new TreeMap<E, MutableInteger>());
|
||||
super(new TreeMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,7 +63,7 @@ public class TreeBag<E> extends AbstractMapBag<E> implements SortedBag<E>, Seria
|
|||
* @param comparator the comparator to use
|
||||
*/
|
||||
public TreeBag(final Comparator<? super E> comparator) {
|
||||
super(new TreeMap<E, MutableInteger>(comparator));
|
||||
super(new TreeMap<>(comparator));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,7 +139,7 @@ public class TreeBag<E> extends AbstractMapBag<E> implements SortedBag<E>, Seria
|
|||
in.defaultReadObject();
|
||||
@SuppressWarnings("unchecked") // This will fail at runtime if the stream is incorrect
|
||||
final Comparator<? super E> comp = (Comparator<? super E>) in.readObject();
|
||||
super.doReadObject(new TreeMap<E, MutableInteger>(comp), in);
|
||||
super.doReadObject(new TreeMap<>(comp), in);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class DualHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> implements
|
|||
* Creates an empty {@code HashBidiMap}.
|
||||
*/
|
||||
public DualHashBidiMap() {
|
||||
super(new HashMap<K, V>(), new HashMap<V, K>());
|
||||
super(new HashMap<>(), new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ public class DualHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> implements
|
|||
* @param map the map whose mappings are to be placed in this map
|
||||
*/
|
||||
public DualHashBidiMap(final Map<? extends K, ? extends V> map) {
|
||||
super(new HashMap<K, V>(), new HashMap<V, K>());
|
||||
super(new HashMap<>(), new HashMap<>());
|
||||
putAll(map);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class DualLinkedHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> imple
|
|||
* Creates an empty {@code HashBidiMap}.
|
||||
*/
|
||||
public DualLinkedHashBidiMap() {
|
||||
super(new LinkedHashMap<K, V>(), new LinkedHashMap<V, K>());
|
||||
super(new LinkedHashMap<>(), new LinkedHashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ public class DualLinkedHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> imple
|
|||
* @param map the map whose mappings are to be placed in this map
|
||||
*/
|
||||
public DualLinkedHashBidiMap(final Map<? extends K, ? extends V> map) {
|
||||
super(new LinkedHashMap<K, V>(), new LinkedHashMap<V, K>());
|
||||
super(new LinkedHashMap<>(), new LinkedHashMap<>());
|
||||
putAll(map);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public class DualTreeBidiMap<K, V> extends AbstractDualBidiMap<K, V>
|
|||
* Creates an empty {@link DualTreeBidiMap}.
|
||||
*/
|
||||
public DualTreeBidiMap() {
|
||||
super(new TreeMap<K, V>(), new TreeMap<V, K>());
|
||||
super(new TreeMap<>(), new TreeMap<>());
|
||||
this.comparator = null;
|
||||
this.valueComparator = null;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class DualTreeBidiMap<K, V> extends AbstractDualBidiMap<K, V>
|
|||
* @param map the map whose mappings are to be placed in this map
|
||||
*/
|
||||
public DualTreeBidiMap(final Map<? extends K, ? extends V> map) {
|
||||
super(new TreeMap<K, V>(), new TreeMap<V, K>());
|
||||
super(new TreeMap<>(), new TreeMap<>());
|
||||
putAll(map);
|
||||
this.comparator = null;
|
||||
this.valueComparator = null;
|
||||
|
@ -97,7 +97,7 @@ public class DualTreeBidiMap<K, V> extends AbstractDualBidiMap<K, V>
|
|||
* @param valueComparator the values comparator to use
|
||||
*/
|
||||
public DualTreeBidiMap(final Comparator<? super K> keyComparator, final Comparator<? super V> valueComparator) {
|
||||
super(new TreeMap<K, V>(keyComparator), new TreeMap<V, K>(valueComparator));
|
||||
super(new TreeMap<>(keyComparator), new TreeMap<>(valueComparator));
|
||||
this.comparator = keyComparator;
|
||||
this.valueComparator = valueComparator;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> {
|
|||
public static <K, C> IndexedCollection<K, C> uniqueIndexedCollection(final Collection<C> coll,
|
||||
final Transformer<C, K> keyTransformer) {
|
||||
return new IndexedCollection<>(coll, keyTransformer,
|
||||
MultiValueMap.<K, C>multiValueMap(new HashMap<K, Collection<C>>()),
|
||||
MultiValueMap.<K, C>multiValueMap(new HashMap<>()),
|
||||
true);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> {
|
|||
public static <K, C> IndexedCollection<K, C> nonUniqueIndexedCollection(final Collection<C> coll,
|
||||
final Transformer<C, K> keyTransformer) {
|
||||
return new IndexedCollection<>(coll, keyTransformer,
|
||||
MultiValueMap.<K, C>multiValueMap(new HashMap<K, Collection<C>>()),
|
||||
MultiValueMap.<K, C>multiValueMap(new HashMap<>()),
|
||||
false);
|
||||
}
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ public class PredicatedCollection<E> extends AbstractCollectionDecorator<E> {
|
|||
* @return a new predicated list.
|
||||
*/
|
||||
public List<E> createPredicatedList() {
|
||||
return createPredicatedList(new ArrayList<E>());
|
||||
return createPredicatedList(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -299,7 +299,7 @@ public class PredicatedCollection<E> extends AbstractCollectionDecorator<E> {
|
|||
* @return a new predicated set.
|
||||
*/
|
||||
public Set<E> createPredicatedSet() {
|
||||
return createPredicatedSet(new HashSet<E>());
|
||||
return createPredicatedSet(new HashSet<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,7 +330,7 @@ public class PredicatedCollection<E> extends AbstractCollectionDecorator<E> {
|
|||
* @return a new predicated multiset.
|
||||
*/
|
||||
public MultiSet<E> createPredicatedMultiSet() {
|
||||
return createPredicatedMultiSet(new HashMultiSet<E>());
|
||||
return createPredicatedMultiSet(new HashMultiSet<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -362,7 +362,7 @@ public class PredicatedCollection<E> extends AbstractCollectionDecorator<E> {
|
|||
* @return a new predicated bag.
|
||||
*/
|
||||
public Bag<E> createPredicatedBag() {
|
||||
return createPredicatedBag(new HashBag<E>());
|
||||
return createPredicatedBag(new HashBag<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -393,7 +393,7 @@ public class PredicatedCollection<E> extends AbstractCollectionDecorator<E> {
|
|||
* @return a new predicated queue.
|
||||
*/
|
||||
public Queue<E> createPredicatedQueue() {
|
||||
return createPredicatedQueue(new LinkedList<E>());
|
||||
return createPredicatedQueue(new LinkedList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ComparatorChain<E> implements Comparator<E>, Serializable {
|
|||
* UnsupportedOperationException is thrown
|
||||
*/
|
||||
public ComparatorChain() {
|
||||
this(new ArrayList<Comparator<E>>(), new BitSet());
|
||||
this(new ArrayList<>(), new BitSet());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -79,7 +79,7 @@ public class GrowthList<E> extends AbstractSerializableListDecorator<E> {
|
|||
* Constructor that uses an ArrayList internally.
|
||||
*/
|
||||
public GrowthList() {
|
||||
super(new ArrayList<E>());
|
||||
super(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,7 +89,7 @@ public class GrowthList<E> extends AbstractSerializableListDecorator<E> {
|
|||
* @throws IllegalArgumentException if initial capacity is invalid
|
||||
*/
|
||||
public GrowthList(final int initialCapacity) {
|
||||
super(new ArrayList<E>(initialCapacity));
|
||||
super(new ArrayList<>(initialCapacity));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -76,11 +76,11 @@ public class SetUniqueList<E> extends AbstractSerializableListDecorator<E> {
|
|||
public static <E> SetUniqueList<E> setUniqueList(final List<E> list) {
|
||||
Objects.requireNonNull(list, "list");
|
||||
if (list.isEmpty()) {
|
||||
return new SetUniqueList<>(list, new HashSet<E>());
|
||||
return new SetUniqueList<>(list, new HashSet<>());
|
||||
}
|
||||
final List<E> temp = new ArrayList<>(list);
|
||||
list.clear();
|
||||
final SetUniqueList<E> sl = new SetUniqueList<>(list, new HashSet<E>());
|
||||
final SetUniqueList<E> sl = new SetUniqueList<>(list, new HashSet<>());
|
||||
sl.addAll(temp);
|
||||
return sl;
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Se
|
|||
* @param defaultValueTransformer transformer to use to generate missing values.
|
||||
*/
|
||||
public DefaultedMap(final Transformer<? super K, ? extends V> defaultValueTransformer) {
|
||||
this(new HashMap<K, V>(), defaultValueTransformer);
|
||||
this(new HashMap<>(), defaultValueTransformer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -114,7 +114,7 @@ public class ListOrderedMap<K, V>
|
|||
* @since 3.1
|
||||
*/
|
||||
public ListOrderedMap() {
|
||||
this(new HashMap<K, V>());
|
||||
this(new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -114,7 +114,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
|
|||
* Constructs a new MultiKeyMap that decorates a {@code HashedMap}.
|
||||
*/
|
||||
public MultiKeyMap() {
|
||||
this(new HashedMap<MultiKey<? extends K>, V>());
|
||||
this(new HashedMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -218,7 +218,7 @@ public class PassiveExpiringMap<K, V>
|
|||
* @throws NullPointerException if expiringPolicy is null
|
||||
*/
|
||||
public PassiveExpiringMap(final ExpirationPolicy<K, V> expiringPolicy) {
|
||||
this(expiringPolicy, new HashMap<K, V>());
|
||||
this(expiringPolicy, new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,8 +249,8 @@ public class PassiveExpiringMap<K, V>
|
|||
* ALWAYS expire.
|
||||
*/
|
||||
public PassiveExpiringMap(final long timeToLiveMillis) {
|
||||
this(new ConstantTimeToLiveExpirationPolicy<K, V>(timeToLiveMillis),
|
||||
new HashMap<K, V>());
|
||||
this(new ConstantTimeToLiveExpirationPolicy<>(timeToLiveMillis),
|
||||
new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -268,7 +268,7 @@ public class PassiveExpiringMap<K, V>
|
|||
* @throws NullPointerException if the map is null.
|
||||
*/
|
||||
public PassiveExpiringMap(final long timeToLiveMillis, final Map<K, V> map) {
|
||||
this(new ConstantTimeToLiveExpirationPolicy<K, V>(timeToLiveMillis),
|
||||
this(new ConstantTimeToLiveExpirationPolicy<>(timeToLiveMillis),
|
||||
map);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class HashMultiSet<E> extends AbstractMapMultiSet<E> implements Serializa
|
|||
* Constructs an empty {@link HashMultiSet}.
|
||||
*/
|
||||
public HashMultiSet() {
|
||||
super(new HashMap<E, MutableInteger>());
|
||||
super(new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ public class HashMultiSet<E> extends AbstractMapMultiSet<E> implements Serializa
|
|||
*/
|
||||
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
setMap(new HashMap<E, MutableInteger>());
|
||||
setMap(new HashMap<>());
|
||||
super.doReadObject(in);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ListOrderedSet<E>
|
|||
* @since 3.1
|
||||
*/
|
||||
public ListOrderedSet() {
|
||||
super(new HashSet<E>());
|
||||
super(new HashSet<>());
|
||||
setOrder = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue