From 4f82195afdc4279c05826fc20f8642bfdaaafec3 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 23 Oct 2016 10:52:50 -0700 Subject: [PATCH] Remove redundant type arguments. --- .../org/apache/commons/lang3/ArrayUtils.java | 20 ++++++------ .../org/apache/commons/lang3/ClassUtils.java | 26 +++++++-------- .../org/apache/commons/lang3/EnumUtils.java | 4 +-- .../org/apache/commons/lang3/LocaleUtils.java | 14 ++++---- .../org/apache/commons/lang3/ObjectUtils.java | 6 ++-- .../java/org/apache/commons/lang3/Range.java | 2 +- .../commons/lang3/SerializationUtils.java | 2 +- .../org/apache/commons/lang3/StringUtils.java | 10 +++--- .../org/apache/commons/lang3/ThreadUtils.java | 6 ++-- .../commons/lang3/builder/DiffBuilder.java | 2 +- .../commons/lang3/builder/EqualsBuilder.java | 4 +-- .../lang3/builder/HashCodeBuilder.java | 4 +-- .../builder/ReflectionToStringBuilder.java | 2 +- .../commons/lang3/builder/ToStringStyle.java | 4 +-- .../concurrent/AbstractCircuitBreaker.java | 2 +- .../lang3/concurrent/AtomicInitializer.java | 2 +- .../concurrent/AtomicSafeInitializer.java | 4 +-- .../lang3/concurrent/ConcurrentUtils.java | 2 +- .../concurrent/EventCountCircuitBreaker.java | 4 +-- .../MultiBackgroundInitializer.java | 8 ++--- .../lang3/event/EventListenerSupport.java | 8 ++--- .../commons/lang3/event/EventUtils.java | 2 +- .../exception/DefaultExceptionContext.java | 8 ++--- .../lang3/exception/ExceptionUtils.java | 8 ++--- .../commons/lang3/reflect/FieldUtils.java | 4 +-- .../commons/lang3/reflect/MethodUtils.java | 4 +-- .../commons/lang3/reflect/TypeUtils.java | 10 +++--- .../lang3/text/ExtendedMessageFormat.java | 4 +-- .../apache/commons/lang3/text/StrLookup.java | 4 +-- .../commons/lang3/text/StrSubstitutor.java | 4 +-- .../commons/lang3/text/StrTokenizer.java | 4 +-- .../text/translate/LookupTranslator.java | 4 +-- .../lang3/time/DurationFormatUtils.java | 2 +- .../commons/lang3/time/FastDateParser.java | 12 +++---- .../commons/lang3/time/FastDatePrinter.java | 4 +-- .../commons/lang3/time/FormatCache.java | 4 +-- .../commons/lang3/tuple/ImmutablePair.java | 2 +- .../commons/lang3/tuple/ImmutableTriple.java | 2 +- .../commons/lang3/tuple/MutablePair.java | 2 +- .../commons/lang3/tuple/MutableTriple.java | 2 +- .../org/apache/commons/lang3/tuple/Pair.java | 2 +- .../apache/commons/lang3/tuple/Triple.java | 2 +- .../apache/commons/lang3/ClassUtilsTest.java | 8 ++--- .../commons/lang3/HashSetvBitSetTest.java | 2 +- .../apache/commons/lang3/LocaleUtilsTest.java | 2 +- .../apache/commons/lang3/ObjectUtilsTest.java | 2 +- .../commons/lang3/SerializationUtilsTest.java | 2 +- .../apache/commons/lang3/ValidateTest.java | 16 +++++----- .../builder/DefaultToStringStyleTest.java | 8 ++--- .../lang3/builder/JsonToStringStyleTest.java | 8 ++--- .../builder/MultiLineToStringStyleTest.java | 8 ++--- .../MultilineRecursiveToStringStyleTest.java | 2 +- .../builder/NoClassNameToStringStyleTest.java | 8 ++--- .../NoFieldNamesToStringStyleTest.java | 8 ++--- .../builder/RecursiveToStringStyleTest.java | 8 ++--- ...lectionToStringBuilderConcurrencyTest.java | 2 +- .../ReflectionToStringBuilderExcludeTest.java | 6 ++-- ...ngBuilderMutateInspectConcurrencyTest.java | 2 +- .../builder/ShortPrefixToStringStyleTest.java | 8 ++--- .../builder/SimpleToStringStyleTest.java | 8 ++--- .../builder/StandardToStringStyleTest.java | 8 ++--- .../lang3/builder/ToStringBuilderTest.java | 18 +++++------ .../builder/ToStringStyleConcurrencyTest.java | 4 +-- .../concurrent/BackgroundInitializerTest.java | 2 +- .../CallableBackgroundInitializerTest.java | 6 ++-- .../lang3/concurrent/ConcurrentUtilsTest.java | 14 ++++---- .../concurrent/ConstantInitializerTest.java | 16 +++++----- .../EventCountCircuitBreakerTest.java | 2 +- .../lang3/event/EventListenerSupportTest.java | 2 +- .../commons/lang3/event/EventUtilsTest.java | 2 +- .../lang3/mutable/MutableObjectTest.java | 32 +++++++++---------- .../lang3/reflect/ConstructorUtilsTest.java | 2 +- .../commons/lang3/reflect/FieldUtilsTest.java | 2 +- .../lang3/reflect/MethodUtilsTest.java | 2 +- .../commons/lang3/reflect/TypeUtilsTest.java | 2 +- .../lang3/text/ExtendedMessageFormatTest.java | 4 +-- .../commons/lang3/text/StrLookupTest.java | 2 +- .../lang3/text/StrSubstitutorTest.java | 22 ++++++------- .../text/translate/EntityArraysTest.java | 8 ++--- .../lang3/time/FastDateParserTest.java | 2 +- .../time/FastDatePrinterTimeZonesTest.java | 2 +- .../lang3/tuple/ImmutablePairTest.java | 4 +-- .../lang3/tuple/ImmutableTripleTest.java | 4 +-- .../commons/lang3/tuple/MutablePairTest.java | 8 ++--- .../lang3/tuple/MutableTripleTest.java | 8 ++--- .../apache/commons/lang3/tuple/PairTest.java | 4 +-- .../commons/lang3/tuple/TripleTest.java | 2 +- 87 files changed, 259 insertions(+), 259 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java index f42a49857..3ba98e5c1 100644 --- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java +++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java @@ -239,7 +239,7 @@ public class ArrayUtils { if (array == null) { return null; } - final Map map = new HashMap((int) (array.length * 1.5)); + final Map map = new HashMap<>((int) (array.length * 1.5)); for (int i = 0; i < array.length; i++) { final Object object = array[i]; if (object instanceof Map.Entry) { @@ -6611,7 +6611,7 @@ public class ArrayUtils { if (isEmpty(array) || isEmpty(values)) { return clone(array); } - final HashMap occurrences = new HashMap(values.length); + final HashMap occurrences = new HashMap<>(values.length); for (final T v : values) { final MutableInt count = occurrences.get(v); if (count == null) { @@ -6701,7 +6701,7 @@ public class ArrayUtils { if (isEmpty(array) || isEmpty(values)) { return clone(array); } - final Map occurrences = new HashMap(values.length); + final Map occurrences = new HashMap<>(values.length); for (final byte v : values) { final Byte boxed = Byte.valueOf(v); final MutableInt count = occurrences.get(boxed); @@ -6789,7 +6789,7 @@ public class ArrayUtils { if (isEmpty(array) || isEmpty(values)) { return clone(array); } - final HashMap occurrences = new HashMap(values.length); + final HashMap occurrences = new HashMap<>(values.length); for (final short v : values) { final Short boxed = Short.valueOf(v); final MutableInt count = occurrences.get(boxed); @@ -6877,7 +6877,7 @@ public class ArrayUtils { if (isEmpty(array) || isEmpty(values)) { return clone(array); } - final HashMap occurrences = new HashMap(values.length); + final HashMap occurrences = new HashMap<>(values.length); for (final int v : values) { final Integer boxed = Integer.valueOf(v); final MutableInt count = occurrences.get(boxed); @@ -6965,7 +6965,7 @@ public class ArrayUtils { if (isEmpty(array) || isEmpty(values)) { return clone(array); } - final HashMap occurrences = new HashMap(values.length); + final HashMap occurrences = new HashMap<>(values.length); for (final char v : values) { final Character boxed = Character.valueOf(v); final MutableInt count = occurrences.get(boxed); @@ -7053,7 +7053,7 @@ public class ArrayUtils { if (isEmpty(array) || isEmpty(values)) { return clone(array); } - final HashMap occurrences = new HashMap(values.length); + final HashMap occurrences = new HashMap<>(values.length); for (final long v : values) { final Long boxed = Long.valueOf(v); final MutableInt count = occurrences.get(boxed); @@ -7141,7 +7141,7 @@ public class ArrayUtils { if (isEmpty(array) || isEmpty(values)) { return clone(array); } - final HashMap occurrences = new HashMap(values.length); + final HashMap occurrences = new HashMap<>(values.length); for (final float v : values) { final Float boxed = Float.valueOf(v); final MutableInt count = occurrences.get(boxed); @@ -7229,7 +7229,7 @@ public class ArrayUtils { if (isEmpty(array) || isEmpty(values)) { return clone(array); } - final HashMap occurrences = new HashMap(values.length); + final HashMap occurrences = new HashMap<>(values.length); for (final double v : values) { final Double boxed = Double.valueOf(v); final MutableInt count = occurrences.get(boxed); @@ -7313,7 +7313,7 @@ public class ArrayUtils { if (isEmpty(array) || isEmpty(values)) { return clone(array); } - final HashMap occurrences = new HashMap(2); // only two possible values here + final HashMap occurrences = new HashMap<>(2); // only two possible values here for (final boolean v : values) { final Boolean boxed = Boolean.valueOf(v); final MutableInt count = occurrences.get(boxed); diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java index da2a7b2a3..465990e57 100644 --- a/src/main/java/org/apache/commons/lang3/ClassUtils.java +++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java @@ -75,7 +75,7 @@ public class ClassUtils { /** * Maps names of primitives to their corresponding primitive {@code Class}es. */ - private static final Map> namePrimitiveMap = new HashMap>(); + private static final Map> namePrimitiveMap = new HashMap<>(); static { namePrimitiveMap.put("boolean", Boolean.TYPE); namePrimitiveMap.put("byte", Byte.TYPE); @@ -91,7 +91,7 @@ public class ClassUtils { /** * Maps primitive {@code Class}es to their corresponding wrapper {@code Class}. */ - private static final Map, Class> primitiveWrapperMap = new HashMap, Class>(); + private static final Map, Class> primitiveWrapperMap = new HashMap<>(); static { primitiveWrapperMap.put(Boolean.TYPE, Boolean.class); primitiveWrapperMap.put(Byte.TYPE, Byte.class); @@ -107,7 +107,7 @@ public class ClassUtils { /** * Maps wrapper {@code Class}es to their corresponding primitive types. */ - private static final Map, Class> wrapperPrimitiveMap = new HashMap, Class>(); + private static final Map, Class> wrapperPrimitiveMap = new HashMap<>(); static { for (final Map.Entry, Class> entry : primitiveWrapperMap.entrySet()) { final Class primitiveClass = entry.getKey(); @@ -132,7 +132,7 @@ public class ClassUtils { * Feed abbreviation maps */ static { - final Map m = new HashMap(); + final Map m = new HashMap<>(); m.put("int", "I"); m.put("boolean", "Z"); m.put("float", "F"); @@ -141,7 +141,7 @@ public class ClassUtils { m.put("byte", "B"); m.put("double", "D"); m.put("char", "C"); - final Map r = new HashMap(); + final Map r = new HashMap<>(); for (final Map.Entry e : m.entrySet()) { r.put(e.getValue(), e.getKey()); } @@ -423,7 +423,7 @@ public class ClassUtils { if (cls == null) { return null; } - final List> classes = new ArrayList>(); + final List> classes = new ArrayList<>(); Class superclass = cls.getSuperclass(); while (superclass != null) { classes.add(superclass); @@ -450,10 +450,10 @@ public class ClassUtils { return null; } - final LinkedHashSet> interfacesFound = new LinkedHashSet>(); + final LinkedHashSet> interfacesFound = new LinkedHashSet<>(); getAllInterfaces(cls, interfacesFound); - return new ArrayList>(interfacesFound); + return new ArrayList<>(interfacesFound); } /** @@ -494,7 +494,7 @@ public class ClassUtils { if (classNames == null) { return null; } - final List> classes = new ArrayList>(classNames.size()); + final List> classes = new ArrayList<>(classNames.size()); for (final String className : classNames) { try { classes.add(Class.forName(className)); @@ -521,7 +521,7 @@ public class ClassUtils { if (classes == null) { return null; } - final List classNames = new ArrayList(classes.size()); + final List classNames = new ArrayList<>(classes.size()); for (final Class cls : classes) { if (cls == null) { classNames.add(null); @@ -1021,7 +1021,7 @@ public class ClassUtils { return declaredMethod; } - final List> candidateClasses = new ArrayList>(); + final List> candidateClasses = new ArrayList<>(); candidateClasses.addAll(getAllInterfaces(cls)); candidateClasses.addAll(getAllSuperclasses(cls)); @@ -1287,7 +1287,7 @@ public class ClassUtils { @Override public Iterator> iterator() { - final Set> seenInterfaces = new HashSet>(); + final Set> seenInterfaces = new HashSet<>(); final Iterator> wrapped = classes.iterator(); return new Iterator>() { @@ -1306,7 +1306,7 @@ public class ClassUtils { return nextInterface; } final Class nextSuperclass = wrapped.next(); - final Set> currentInterfaces = new LinkedHashSet>(); + final Set> currentInterfaces = new LinkedHashSet<>(); walkInterfaces(currentInterfaces, nextSuperclass); interfaces = currentInterfaces.iterator(); return nextSuperclass; diff --git a/src/main/java/org/apache/commons/lang3/EnumUtils.java b/src/main/java/org/apache/commons/lang3/EnumUtils.java index 699a21539..8280bf845 100644 --- a/src/main/java/org/apache/commons/lang3/EnumUtils.java +++ b/src/main/java/org/apache/commons/lang3/EnumUtils.java @@ -55,7 +55,7 @@ public class EnumUtils { * @return the modifiable map of enum names to enums, never null */ public static > Map getEnumMap(final Class enumClass) { - final Map map = new LinkedHashMap(); + final Map map = new LinkedHashMap<>(); for (final E e: enumClass.getEnumConstants()) { map.put(e.name(), e); } @@ -72,7 +72,7 @@ public class EnumUtils { * @return the modifiable list of enums, never null */ public static > List getEnumList(final Class enumClass) { - return new ArrayList(Arrays.asList(enumClass.getEnumConstants())); + return new ArrayList<>(Arrays.asList(enumClass.getEnumConstants())); } /** diff --git a/src/main/java/org/apache/commons/lang3/LocaleUtils.java b/src/main/java/org/apache/commons/lang3/LocaleUtils.java index 418537394..a3126ebf4 100644 --- a/src/main/java/org/apache/commons/lang3/LocaleUtils.java +++ b/src/main/java/org/apache/commons/lang3/LocaleUtils.java @@ -39,11 +39,11 @@ public class LocaleUtils { /** Concurrent map of language locales by country. */ private static final ConcurrentMap> cLanguagesByCountry = - new ConcurrentHashMap>(); + new ConcurrentHashMap<>(); /** Concurrent map of country locales by language. */ private static final ConcurrentMap> cCountriesByLanguage = - new ConcurrentHashMap>(); + new ConcurrentHashMap<>(); /** *

{@code LocaleUtils} instances should NOT be constructed in standard programming. @@ -189,7 +189,7 @@ public class LocaleUtils { * @return the unmodifiable list of Locale objects, 0 being locale, not null */ public static List localeLookupList(final Locale locale, final Locale defaultLocale) { - final List list = new ArrayList(4); + final List list = new ArrayList<>(4); if (locale != null) { list.add(locale); if (locale.getVariant().length() > 0) { @@ -260,7 +260,7 @@ public class LocaleUtils { } List langs = cLanguagesByCountry.get(countryCode); if (langs == null) { - langs = new ArrayList(); + langs = new ArrayList<>(); final List locales = availableLocaleList(); for (int i = 0; i < locales.size(); i++) { final Locale locale = locales.get(i); @@ -292,7 +292,7 @@ public class LocaleUtils { } List countries = cCountriesByLanguage.get(languageCode); if (countries == null) { - countries = new ArrayList(); + countries = new ArrayList<>(); final List locales = availableLocaleList(); for (int i = 0; i < locales.size(); i++) { final Locale locale = locales.get(i); @@ -318,9 +318,9 @@ public class LocaleUtils { private static final Set AVAILABLE_LOCALE_SET; static { - final List list = new ArrayList(Arrays.asList(Locale.getAvailableLocales())); // extra safe + final List list = new ArrayList<>(Arrays.asList(Locale.getAvailableLocales())); // extra safe AVAILABLE_LOCALE_LIST = Collections.unmodifiableList(list); - AVAILABLE_LOCALE_SET = Collections.unmodifiableSet(new HashSet(list)); + AVAILABLE_LOCALE_SET = Collections.unmodifiableSet(new HashSet<>(list)); } } diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java index d328105e0..84b4b1066 100644 --- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java +++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java @@ -586,7 +586,7 @@ public class ObjectUtils { public static > T median(final T... items) { Validate.notEmpty(items); Validate.noNullElements(items); - final TreeSet sort = new TreeSet(); + final TreeSet sort = new TreeSet<>(); Collections.addAll(sort, items); @SuppressWarnings("unchecked") //we know all items added were T instances final @@ -609,7 +609,7 @@ public class ObjectUtils { Validate.notEmpty(items, "null/empty items"); Validate.noNullElements(items); Validate.notNull(comparator, "null comparator"); - final TreeSet sort = new TreeSet(comparator); + final TreeSet sort = new TreeSet<>(comparator); Collections.addAll(sort, items); @SuppressWarnings("unchecked") //we know all items added were T instances final @@ -629,7 +629,7 @@ public class ObjectUtils { */ public static T mode(final T... items) { if (ArrayUtils.isNotEmpty(items)) { - final HashMap occurrences = new HashMap(items.length); + final HashMap occurrences = new HashMap<>(items.length); for (final T t : items) { final MutableInt count = occurrences.get(t); if (count == null) { diff --git a/src/main/java/org/apache/commons/lang3/Range.java b/src/main/java/org/apache/commons/lang3/Range.java index 40afba8c9..73e696991 100644 --- a/src/main/java/org/apache/commons/lang3/Range.java +++ b/src/main/java/org/apache/commons/lang3/Range.java @@ -131,7 +131,7 @@ public final class Range implements Serializable { * @throws ClassCastException if using natural ordering and the elements are not {@code Comparable} */ public static Range between(final T fromInclusive, final T toInclusive, final Comparator comparator) { - return new Range(fromInclusive, toInclusive, comparator); + return new Range<>(fromInclusive, toInclusive, comparator); } /** diff --git a/src/main/java/org/apache/commons/lang3/SerializationUtils.java b/src/main/java/org/apache/commons/lang3/SerializationUtils.java index a5a7b49be..9e60e6908 100644 --- a/src/main/java/org/apache/commons/lang3/SerializationUtils.java +++ b/src/main/java/org/apache/commons/lang3/SerializationUtils.java @@ -280,7 +280,7 @@ public class SerializationUtils { */ static class ClassLoaderAwareObjectInputStream extends ObjectInputStream { private static final Map> primitiveTypes = - new HashMap>(); + new HashMap<>(); static { primitiveTypes.put("byte", byte.class); diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 8405a9f84..b911af168 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -3002,7 +3002,7 @@ public class StringUtils { } final int closeLen = close.length(); final int openLen = open.length(); - final List list = new ArrayList(); + final List list = new ArrayList<>(); int pos = 0; while (pos < strLen - closeLen) { int start = str.indexOf(open, pos); @@ -3298,7 +3298,7 @@ public class StringUtils { final int separatorLength = separator.length(); - final ArrayList substrings = new ArrayList(); + final ArrayList substrings = new ArrayList<>(); int numberOfSubstrings = 0; int beg = 0; int end = 0; @@ -3432,7 +3432,7 @@ public class StringUtils { if (len == 0) { return ArrayUtils.EMPTY_STRING_ARRAY; } - final List list = new ArrayList(); + final List list = new ArrayList<>(); int i = 0, start = 0; boolean match = false; boolean lastMatch = false; @@ -3559,7 +3559,7 @@ public class StringUtils { if (len == 0) { return ArrayUtils.EMPTY_STRING_ARRAY; } - final List list = new ArrayList(); + final List list = new ArrayList<>(); int sizePlus1 = 1; int i = 0, start = 0; boolean match = false; @@ -3705,7 +3705,7 @@ public class StringUtils { return ArrayUtils.EMPTY_STRING_ARRAY; } final char[] c = str.toCharArray(); - final List list = new ArrayList(); + final List list = new ArrayList<>(); int tokenStart = 0; int currentType = Character.getType(c[tokenStart]); for (int pos = tokenStart + 1; pos < c.length; pos++) { diff --git a/src/main/java/org/apache/commons/lang3/ThreadUtils.java b/src/main/java/org/apache/commons/lang3/ThreadUtils.java index 89a59cea5..93a48b7f1 100644 --- a/src/main/java/org/apache/commons/lang3/ThreadUtils.java +++ b/src/main/java/org/apache/commons/lang3/ThreadUtils.java @@ -131,7 +131,7 @@ public class ThreadUtils { return Collections.emptyList(); } - final Collection result = new ArrayList(); + final Collection result = new ArrayList<>(); final NamePredicate threadNamePredicate = new NamePredicate(threadName); for(final ThreadGroup group : threadGroups) { result.addAll(findThreads(group, false, threadNamePredicate)); @@ -413,7 +413,7 @@ public class ThreadUtils { //return value of enumerate() must be strictly less than the array size according to javadoc } while (count >= threads.length); - final List result = new ArrayList(count); + final List result = new ArrayList<>(count); for (int i = 0; i < count; ++i) { if (predicate.test(threads[i])) { result.add(threads[i]); @@ -449,7 +449,7 @@ public class ThreadUtils { //return value of enumerate() must be strictly less than the array size according to javadoc } while(count >= threadGroups.length); - final List result = new ArrayList(count); + final List result = new ArrayList<>(count); for(int i = 0; i < count; ++i) { if(predicate.test(threadGroups[i])) { result.add(threadGroups[i]); diff --git a/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java b/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java index 68589526c..e9804d5ab 100644 --- a/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java @@ -109,7 +109,7 @@ public class DiffBuilder implements Builder { throw new IllegalArgumentException("rhs cannot be null"); } - this.diffs = new ArrayList>(); + this.diffs = new ArrayList<>(); this.left = lhs; this.right = rhs; this.style = style; diff --git a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java index 502f055d4..c25e9286e 100644 --- a/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java @@ -92,7 +92,7 @@ public class EqualsBuilder implements Builder { * * @since 3.0 */ - private static final ThreadLocal>> REGISTRY = new ThreadLocal>>(); + private static final ThreadLocal>> REGISTRY = new ThreadLocal<>(); /* * NOTE: we cannot store the actual objects in a HashSet, as that would use the very hashCode() @@ -174,7 +174,7 @@ public class EqualsBuilder implements Builder { private static void register(final Object lhs, final Object rhs) { Set> registry = getRegistry(); if (registry == null) { - registry = new HashSet>(); + registry = new HashSet<>(); REGISTRY.set(registry); } final Pair pair = getRegisterPair(lhs, rhs); diff --git a/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java b/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java index 6dbc8e6b0..7df9fb6dd 100644 --- a/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java @@ -118,7 +118,7 @@ public class HashCodeBuilder implements Builder { * * @since 2.3 */ - private static final ThreadLocal> REGISTRY = new ThreadLocal>(); + private static final ThreadLocal> REGISTRY = new ThreadLocal<>(); /* * NOTE: we cannot store the actual objects in a HashSet, as that would use the very hashCode() @@ -500,7 +500,7 @@ public class HashCodeBuilder implements Builder { private static void register(final Object value) { Set registry = getRegistry(); if (registry == null) { - registry = new HashSet(); + registry = new HashSet<>(); REGISTRY.set(registry); } registry.add(new IDKey(value)); diff --git a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java index 61ce6660b..d40a838a3 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java @@ -340,7 +340,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder { * @return The given array or a new array without null. */ static String[] toNoNullStringArray(final Object[] array) { - final List list = new ArrayList(array.length); + final List list = new ArrayList<>(array.length); for (final Object e : array) { if (e != null) { list.add(e.toString()); diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java index ec48d2b64..8a8e653e1 100644 --- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java +++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java @@ -165,7 +165,7 @@ public abstract class ToStringStyle implements Serializable { *

*/ private static final ThreadLocal> REGISTRY = - new ThreadLocal>(); + new ThreadLocal<>(); /* * Note that objects of this class are generally shared between threads, so * an instance variable would not be suitable here. @@ -217,7 +217,7 @@ public abstract class ToStringStyle implements Serializable { if (value != null) { final Map m = getRegistry(); if (m == null) { - REGISTRY.set(new WeakHashMap()); + REGISTRY.set(new WeakHashMap<>()); } getRegistry().put(value, null); } diff --git a/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java b/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java index dfe365167..931c56535 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/AbstractCircuitBreaker.java @@ -34,7 +34,7 @@ public abstract class AbstractCircuitBreaker implements CircuitBreaker { public static final String PROPERTY_NAME = "open"; /** The current state of this circuit breaker. */ - protected final AtomicReference state = new AtomicReference(State.CLOSED); + protected final AtomicReference state = new AtomicReference<>(State.CLOSED); /** An object for managing change listeners registered at this instance. */ private final PropertyChangeSupport changeSupport; diff --git a/src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java index 416dba7e0..ac4b85e8a 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/AtomicInitializer.java @@ -65,7 +65,7 @@ import java.util.concurrent.atomic.AtomicReference; */ public abstract class AtomicInitializer implements ConcurrentInitializer { /** Holds the reference to the managed object. */ - private final AtomicReference reference = new AtomicReference(); + private final AtomicReference reference = new AtomicReference<>(); /** * Returns the object managed by this initializer. The object is created if diff --git a/src/main/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java index 3ad5e4eb3..0b1a500c8 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializer.java @@ -56,10 +56,10 @@ public abstract class AtomicSafeInitializer implements ConcurrentInitializer { /** A guard which ensures that initialize() is called only once. */ private final AtomicReference> factory = - new AtomicReference>(); + new AtomicReference<>(); /** Holds the reference to the managed object. */ - private final AtomicReference reference = new AtomicReference(); + private final AtomicReference reference = new AtomicReference<>(); /** * Get (and initialize, if not initialized yet) the required object diff --git a/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java b/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java index 06c4080ab..d02452407 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/ConcurrentUtils.java @@ -322,7 +322,7 @@ public class ConcurrentUtils { * @return an instance of Future that will return the value, never null */ public static Future constantFuture(final T value) { - return new ConstantFuture(value); + return new ConstantFuture<>(value); } /** diff --git a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java index c5539352a..504ac3626 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java @@ -175,7 +175,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker { TimeUnit openingUnit, int closingThreshold, long closingInterval, TimeUnit closingUnit) { super(); - checkIntervalData = new AtomicReference(new CheckIntervalData(0, 0)); + checkIntervalData = new AtomicReference<>(new CheckIntervalData(0, 0)); this.openingThreshold = openingThreshold; this.openingInterval = openingUnit.toNanos(openingInterval); this.closingThreshold = closingThreshold; @@ -416,7 +416,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker { * @return the strategy map */ private static Map createStrategyMap() { - Map map = new EnumMap(State.class); + Map map = new EnumMap<>(State.class); map.put(State.CLOSED, new StateStrategyClosed()); map.put(State.OPEN, new StateStrategyOpen()); return map; diff --git a/src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java index 2ca5c6e49..c67253899 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializer.java @@ -98,7 +98,7 @@ public class MultiBackgroundInitializer BackgroundInitializer { /** A map with the child initializers. */ private final Map> childInitializers = - new HashMap>(); + new HashMap<>(); /** * Creates a new instance of {@code MultiBackgroundInitializer}. @@ -185,7 +185,7 @@ public class MultiBackgroundInitializer Map> inits; synchronized (this) { // create a snapshot to operate on - inits = new HashMap>( + inits = new HashMap<>( childInitializers); } @@ -200,8 +200,8 @@ public class MultiBackgroundInitializer } // collect the results - final Map results = new HashMap(); - final Map excepts = new HashMap(); + final Map results = new HashMap<>(); + final Map excepts = new HashMap<>(); for (final Map.Entry> e : inits.entrySet()) { try { results.put(e.getKey(), e.getValue().get()); diff --git a/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java b/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java index 8ad04ccec..5d3ed6be0 100644 --- a/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java +++ b/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java @@ -76,7 +76,7 @@ public class EventListenerSupport implements Serializable { * intentionally a thread-safe copy-on-write-array so that traversals over * the list of listeners will be atomic. */ - private List listeners = new CopyOnWriteArrayList(); + private List listeners = new CopyOnWriteArrayList<>(); /** * The proxy representing the collection of listeners. Calls to this proxy @@ -106,7 +106,7 @@ public class EventListenerSupport implements Serializable { * not an interface. */ public static EventListenerSupport create(final Class listenerInterface) { - return new EventListenerSupport(listenerInterface); + return new EventListenerSupport<>(listenerInterface); } /** @@ -240,7 +240,7 @@ public class EventListenerSupport implements Serializable { * @throws IOException if an IO error occurs */ private void writeObject(final ObjectOutputStream objectOutputStream) throws IOException { - final ArrayList serializableListeners = new ArrayList(); + final ArrayList serializableListeners = new ArrayList<>(); // don't just rely on instanceof Serializable: ObjectOutputStream testObjectOutputStream = new ObjectOutputStream(new ByteArrayOutputStream()); @@ -271,7 +271,7 @@ public class EventListenerSupport implements Serializable { final L[] srcListeners = (L[]) objectInputStream.readObject(); - this.listeners = new CopyOnWriteArrayList(srcListeners); + this.listeners = new CopyOnWriteArrayList<>(srcListeners); @SuppressWarnings("unchecked") // Will throw CCE here if not correct final diff --git a/src/main/java/org/apache/commons/lang3/event/EventUtils.java b/src/main/java/org/apache/commons/lang3/event/EventUtils.java index 0bddc9309..c5baf62c7 100644 --- a/src/main/java/org/apache/commons/lang3/event/EventUtils.java +++ b/src/main/java/org/apache/commons/lang3/event/EventUtils.java @@ -93,7 +93,7 @@ public class EventUtils { EventBindingInvocationHandler(final Object target, final String methodName, final String[] eventTypes) { this.target = target; this.methodName = methodName; - this.eventTypes = new HashSet(Arrays.asList(eventTypes)); + this.eventTypes = new HashSet<>(Arrays.asList(eventTypes)); } /** diff --git a/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java b/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java index adaf058b2..17d98a456 100644 --- a/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java +++ b/src/main/java/org/apache/commons/lang3/exception/DefaultExceptionContext.java @@ -44,14 +44,14 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { private static final long serialVersionUID = 20110706L; /** The list storing the label-data pairs. */ - private final List> contextValues = new ArrayList>(); + private final List> contextValues = new ArrayList<>(); /** * {@inheritDoc} */ @Override public DefaultExceptionContext addContextValue(final String label, final Object value) { - contextValues.add(new ImmutablePair(label, value)); + contextValues.add(new ImmutablePair<>(label, value)); return this; } @@ -75,7 +75,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { */ @Override public List getContextValues(final String label) { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final Pair pair : contextValues) { if (StringUtils.equals(label, pair.getKey())) { values.add(pair.getValue()); @@ -102,7 +102,7 @@ public class DefaultExceptionContext implements ExceptionContext, Serializable { */ @Override public Set getContextLabels() { - final Set labels = new HashSet(); + final Set labels = new HashSet<>(); for (final Pair pair : contextValues) { labels.add(pair.getKey()); } diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java index 4fc6774f4..f26a07a34 100644 --- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java +++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java @@ -283,7 +283,7 @@ public class ExceptionUtils { * @since Commons Lang 2.2 */ public static List getThrowableList(Throwable throwable) { - final List list = new ArrayList(); + final List list = new ArrayList<>(); while (throwable != null && list.contains(throwable) == false) { list.add(throwable); throwable = ExceptionUtils.getCause(throwable); @@ -524,7 +524,7 @@ public class ExceptionUtils { } final Throwable throwables[] = getThrowables(throwable); final int count = throwables.length; - final List frames = new ArrayList(); + final List frames = new ArrayList<>(); List nextTrace = getStackFrameList(throwables[count - 1]); for (int i = count; --i >= 0;) { final List trace = nextTrace; @@ -623,7 +623,7 @@ public class ExceptionUtils { static String[] getStackFrames(final String stackTrace) { final String linebreak = SystemUtils.LINE_SEPARATOR; final StringTokenizer frames = new StringTokenizer(stackTrace, linebreak); - final List list = new ArrayList(); + final List list = new ArrayList<>(); while (frames.hasMoreTokens()) { list.add(frames.nextToken()); } @@ -646,7 +646,7 @@ public class ExceptionUtils { final String stackTrace = getStackTrace(t); final String linebreak = SystemUtils.LINE_SEPARATOR; final StringTokenizer frames = new StringTokenizer(stackTrace, linebreak); - final List list = new ArrayList(); + final List list = new ArrayList<>(); boolean traceStarted = false; while (frames.hasMoreTokens()) { final String token = frames.nextToken(); diff --git a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java index f8fc11369..8b4ac3042 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java @@ -211,7 +211,7 @@ public class FieldUtils { */ public static List getAllFieldsList(final Class cls) { Validate.isTrue(cls != null, "The class must not be null"); - final List allFields = new ArrayList(); + final List allFields = new ArrayList<>(); Class currentClass = cls; while (currentClass != null) { final Field[] declaredFields = currentClass.getDeclaredFields(); @@ -253,7 +253,7 @@ public class FieldUtils { public static List getFieldsListWithAnnotation(final Class cls, final Class annotationCls) { Validate.isTrue(annotationCls != null, "The annotation class must not be null"); final List allFields = getAllFieldsList(cls); - final List annotatedFields = new ArrayList(); + final List annotatedFields = new ArrayList<>(); for (final Field field : allFields) { if (field.getAnnotation(annotationCls) != null) { annotatedFields.add(field); diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java index 29fbf3759..cc0a0e40e 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java @@ -781,7 +781,7 @@ public class MethodUtils { */ public static Set getOverrideHierarchy(final Method method, final Interfaces interfacesBehavior) { Validate.notNull(method); - final Set result = new LinkedHashSet(); + final Set result = new LinkedHashSet<>(); result.add(method); final Class[] parameterTypes = method.getParameterTypes(); @@ -847,7 +847,7 @@ public class MethodUtils { Validate.isTrue(cls != null, "The class must not be null"); Validate.isTrue(annotationCls != null, "The annotation class must not be null"); final Method[] allMethods = cls.getMethods(); - final List annotatedMethods = new ArrayList(); + final List annotatedMethods = new ArrayList<>(); for (final Method method : allMethods) { if (method.getAnnotation(annotationCls) != null) { annotatedMethods.add(method); diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java index 30e9940ba..ad032e8f0 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java @@ -865,7 +865,7 @@ public class TypeUtils { } else { // no owner, prep the type variable assignments map typeVarAssigns = subtypeVarAssigns == null ? new HashMap, Type>() - : new HashMap, Type>(subtypeVarAssigns); + : new HashMap<>(subtypeVarAssigns); } // get the subject parameterized type's arguments @@ -910,7 +910,7 @@ public class TypeUtils { if (toClass.isPrimitive()) { // dealing with widening here. No type arguments to be // harvested with these two types. - return new HashMap, Type>(); + return new HashMap<>(); } // work with wrapper the wrapper class instead of the primitive @@ -919,7 +919,7 @@ public class TypeUtils { // create a copy of the incoming map, or an empty one if it's null final HashMap, Type> typeVarAssigns = subtypeVarAssigns == null ? new HashMap, Type>() - : new HashMap, Type>(subtypeVarAssigns); + : new HashMap<>(subtypeVarAssigns); // has target class been reached? if (toClass.equals(cls)) { @@ -1132,7 +1132,7 @@ public class TypeUtils { return bounds; } - final Set types = new HashSet(bounds.length); + final Set types = new HashSet<>(bounds.length); for (final Type type1 : bounds) { boolean subtypeFound = false; @@ -1377,7 +1377,7 @@ public class TypeUtils { if (p.getOwnerType() == null) { parameterizedTypeArguments = typeArguments; } else { - parameterizedTypeArguments = new HashMap, Type>(typeArguments); + parameterizedTypeArguments = new HashMap<>(typeArguments); parameterizedTypeArguments.putAll(TypeUtils.getTypeArguments(p)); } final Type[] args = p.getActualTypeArguments(); diff --git a/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java b/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java index d0835aa26..2c6a10ec8 100644 --- a/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java +++ b/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java @@ -145,8 +145,8 @@ public class ExtendedMessageFormat extends MessageFormat { toPattern = super.toPattern(); return; } - final ArrayList foundFormats = new ArrayList(); - final ArrayList foundDescriptions = new ArrayList(); + final ArrayList foundFormats = new ArrayList<>(); + final ArrayList foundDescriptions = new ArrayList<>(); final StringBuilder stripCustom = new StringBuilder(pattern.length()); final ParsePosition pos = new ParsePosition(0); diff --git a/src/main/java/org/apache/commons/lang3/text/StrLookup.java b/src/main/java/org/apache/commons/lang3/text/StrLookup.java index 446ee4cac..01e87f29d 100644 --- a/src/main/java/org/apache/commons/lang3/text/StrLookup.java +++ b/src/main/java/org/apache/commons/lang3/text/StrLookup.java @@ -38,7 +38,7 @@ public abstract class StrLookup { /** * Lookup that always returns null. */ - private static final StrLookup NONE_LOOKUP = new MapStrLookup(null); + private static final StrLookup NONE_LOOKUP = new MapStrLookup<>(null); /** * Lookup based on system properties. @@ -81,7 +81,7 @@ public abstract class StrLookup { * @return a lookup using the map, not null */ public static StrLookup mapLookup(final Map map) { - return new MapStrLookup(map); + return new MapStrLookup<>(map); } //----------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java b/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java index 126af84cc..db3a99a22 100644 --- a/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java +++ b/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java @@ -213,7 +213,7 @@ public class StrSubstitutor { if (valueProperties == null) { return source.toString(); } - final Map valueMap = new HashMap(); + final Map valueMap = new HashMap<>(); final Enumeration propNames = valueProperties.propertyNames(); while (propNames.hasMoreElements()) { final String propName = (String)propNames.nextElement(); @@ -837,7 +837,7 @@ public class StrSubstitutor { // on the first call initialize priorVariables if (priorVariables == null) { - priorVariables = new ArrayList(); + priorVariables = new ArrayList<>(); priorVariables.add(new String(chars, offset, length)); } diff --git a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java index 53782ce07..5ce5199d1 100644 --- a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java +++ b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java @@ -440,7 +440,7 @@ public class StrTokenizer implements ListIterator, Cloneable { */ public List getTokenList() { checkTokenized(); - final List list = new ArrayList(tokens.length); + final List list = new ArrayList<>(tokens.length); for (final String element : tokens) { list.add(element); } @@ -636,7 +636,7 @@ public class StrTokenizer implements ListIterator, Cloneable { return Collections.emptyList(); } final StrBuilder buf = new StrBuilder(); - final List tokenList = new ArrayList(); + final List tokenList = new ArrayList<>(); int pos = offset; // loop around the entire buffer diff --git a/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java b/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java index ea1fbc31c..d6cea6668 100644 --- a/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java +++ b/src/main/java/org/apache/commons/lang3/text/translate/LookupTranslator.java @@ -43,8 +43,8 @@ public class LookupTranslator extends CharSequenceTranslator { * @param lookup CharSequence[][] table of size [*][2] */ public LookupTranslator(final CharSequence[]... lookup) { - lookupMap = new HashMap(); - prefixSet = new HashSet(); + lookupMap = new HashMap<>(); + prefixSet = new HashSet<>(); int _shortest = Integer.MAX_VALUE; int _longest = 0; if (lookup != null) { diff --git a/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java b/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java index b471e36ff..d1396667c 100644 --- a/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java +++ b/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java @@ -494,7 +494,7 @@ public class DurationFormatUtils { * @return array of Token[] */ static Token[] lexx(final String format) { - final ArrayList list = new ArrayList(format.length()); + final ArrayList list = new ArrayList<>(format.length()); boolean inLiteral = false; // Although the buffer is stored in a Token, the Tokens are only diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java index f52008dea..f6caf101e 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java @@ -160,7 +160,7 @@ public class FastDateParser implements DateParser, Serializable { * @param definingCalendar the {@link java.util.Calendar} instance used to initialize this FastDateParser */ private void init(final Calendar definingCalendar) { - patterns = new ArrayList(); + patterns = new ArrayList<>(); StrategyParser fm = new StrategyParser(pattern, definingCalendar); for(;;) { @@ -464,10 +464,10 @@ public class FastDateParser implements DateParser, Serializable { * @return The map of string display names to field values */ private static Map appendDisplayNames(Calendar cal, Locale locale, int field, StringBuilder regex) { - Map values = new HashMap(); + Map values = new HashMap<>(); Map displayNames = cal.getDisplayNames(field, Calendar.ALL_STYLES, locale); - TreeSet sorted = new TreeSet(LONGER_FIRST_LOWERCASE); + TreeSet sorted = new TreeSet<>(LONGER_FIRST_LOWERCASE); for (Map.Entry displayName : displayNames.entrySet()) { String key = displayName.getKey().toLowerCase(locale); if (sorted.add(key)) { @@ -618,7 +618,7 @@ public class FastDateParser implements DateParser, Serializable { private static ConcurrentMap getCache(final int field) { synchronized (caches) { if (caches[field] == null) { - caches[field] = new ConcurrentHashMap(3); + caches[field] = new ConcurrentHashMap<>(3); } return caches[field]; } @@ -815,7 +815,7 @@ public class FastDateParser implements DateParser, Serializable { private static final String GMT_OPTION= "GMT[+-]\\d{1,2}:\\d{2}"; private final Locale locale; - private final Map tzNames= new HashMap(); + private final Map tzNames= new HashMap<>(); private static class TzInfo { TimeZone zone; @@ -842,7 +842,7 @@ public class FastDateParser implements DateParser, Serializable { final StringBuilder sb = new StringBuilder(); sb.append("((?iu)" + RFC_822_TIME_ZONE + "|" + GMT_OPTION ); - final Set sorted = new TreeSet(LONGER_FIRST_LOWERCASE); + final Set sorted = new TreeSet<>(LONGER_FIRST_LOWERCASE); final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); for (final String[] zoneNames : zones) { diff --git a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java index ae184f2ae..8198063b5 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java @@ -180,7 +180,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { */ protected List parsePattern() { final DateFormatSymbols symbols = new DateFormatSymbols(mLocale); - final List rules = new ArrayList(); + final List rules = new ArrayList<>(); final String[] ERAs = symbols.getEras(); final String[] months = symbols.getMonths(); @@ -1302,7 +1302,7 @@ public class FastDatePrinter implements DatePrinter, Serializable { //----------------------------------------------------------------------- private static final ConcurrentMap cTimeZoneDisplayCache = - new ConcurrentHashMap(7); + new ConcurrentHashMap<>(7); /** *

Gets the time zone display name, using a cache for performance.

* diff --git a/src/main/java/org/apache/commons/lang3/time/FormatCache.java b/src/main/java/org/apache/commons/lang3/time/FormatCache.java index 9224b59f1..e0e26c422 100644 --- a/src/main/java/org/apache/commons/lang3/time/FormatCache.java +++ b/src/main/java/org/apache/commons/lang3/time/FormatCache.java @@ -38,10 +38,10 @@ abstract class FormatCache { static final int NONE= -1; private final ConcurrentMap cInstanceCache - = new ConcurrentHashMap(7); + = new ConcurrentHashMap<>(7); private static final ConcurrentMap cDateTimeInstanceCache - = new ConcurrentHashMap(7); + = new ConcurrentHashMap<>(7); /** *

Gets a formatter instance using the default pattern in the diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java index dfb66ebda..c2b92beb5 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java +++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java @@ -54,7 +54,7 @@ public final class ImmutablePair extends Pair { * @return a pair formed from the two parameters, not null */ public static ImmutablePair of(final L left, final R right) { - return new ImmutablePair(left, right); + return new ImmutablePair<>(left, right); } /** diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java b/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java index cc64c0d48..68ef74288 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java +++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java @@ -59,7 +59,7 @@ public final class ImmutableTriple extends Triple { * @return a triple formed from the three parameters, not null */ public static ImmutableTriple of(final L left, final M middle, final R right) { - return new ImmutableTriple(left, middle, right); + return new ImmutableTriple<>(left, middle, right); } /** diff --git a/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java b/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java index 35ab57619..3c99ac404 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java +++ b/src/main/java/org/apache/commons/lang3/tuple/MutablePair.java @@ -49,7 +49,7 @@ public class MutablePair extends Pair { * @return a pair formed from the two parameters, not null */ public static MutablePair of(final L left, final R right) { - return new MutablePair(left, right); + return new MutablePair<>(left, right); } /** diff --git a/src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java b/src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java index 1d3218433..bb695dd98 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java +++ b/src/main/java/org/apache/commons/lang3/tuple/MutableTriple.java @@ -54,7 +54,7 @@ public class MutableTriple extends Triple { * @return a triple formed from the three parameters, not null */ public static MutableTriple of(final L left, final M middle, final R right) { - return new MutableTriple(left, middle, right); + return new MutableTriple<>(left, middle, right); } /** diff --git a/src/main/java/org/apache/commons/lang3/tuple/Pair.java b/src/main/java/org/apache/commons/lang3/tuple/Pair.java index 1f5a47174..94b421c2c 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/Pair.java +++ b/src/main/java/org/apache/commons/lang3/tuple/Pair.java @@ -56,7 +56,7 @@ public abstract class Pair implements Map.Entry, Comparable Pair of(final L left, final R right) { - return new ImmutablePair(left, right); + return new ImmutablePair<>(left, right); } //----------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/tuple/Triple.java b/src/main/java/org/apache/commons/lang3/tuple/Triple.java index 37d1b15ba..8e98160e7 100644 --- a/src/main/java/org/apache/commons/lang3/tuple/Triple.java +++ b/src/main/java/org/apache/commons/lang3/tuple/Triple.java @@ -57,7 +57,7 @@ public abstract class Triple implements Comparable>, Se * @return a triple formed from the three parameters, not null */ public static Triple of(final L left, final M middle, final R right) { - return new ImmutableTriple(left, middle, right); + return new ImmutableTriple<>(left, middle, right); } //----------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java index e8f9eb0ea..7113f3363 100644 --- a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java @@ -302,7 +302,7 @@ public class ClassUtilsTest { // ------------------------------------------------------------------------- @Test public void test_convertClassNamesToClasses_List() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); List> result = ClassUtils.convertClassNamesToClasses(list); assertEquals(0, result.size()); @@ -328,7 +328,7 @@ public class ClassUtilsTest { @Test public void test_convertClassesToClassNames_List() { - final List> list = new ArrayList>(); + final List> list = new ArrayList<>(); List result = ClassUtils.convertClassesToClassNames(list); assertEquals(0, result.size()); @@ -1103,7 +1103,7 @@ public class ClassUtilsTest { @Test public void testShowJavaBug() throws Exception { // Tests with Collections$UnmodifiableSet - final Set set = Collections.unmodifiableSet(new HashSet()); + final Set set = Collections.unmodifiableSet(new HashSet<>()); final Method isEmptyMethod = set.getClass().getMethod("isEmpty", new Class[0]); try { isEmptyMethod.invoke(set, new Object[0]); @@ -1116,7 +1116,7 @@ public class ClassUtilsTest { @Test public void testGetPublicMethod() throws Exception { // Tests with Collections$UnmodifiableSet - final Set set = Collections.unmodifiableSet(new HashSet()); + final Set set = Collections.unmodifiableSet(new HashSet<>()); final Method isEmptyMethod = ClassUtils.getPublicMethod(set.getClass(), "isEmpty", new Class[0]); assertTrue(Modifier.isPublic(isEmptyMethod.getDeclaringClass().getModifiers())); diff --git a/src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java b/src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java index eb3508940..994631f62 100644 --- a/src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java +++ b/src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java @@ -80,7 +80,7 @@ public class HashSetvBitSetTest { @SuppressWarnings("boxing") private static int[] testHashSet(final int count) { - final HashSet toRemove = new HashSet(); + final HashSet toRemove = new HashSet<>(); int found = 0; for (int i = 0; i < count; i++) { toRemove.add(found++); diff --git a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java index b80766690..196f194d0 100644 --- a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java @@ -349,7 +349,7 @@ public class LocaleUtilsTest { final Locale[] jdkLocaleArray = Locale.getAvailableLocales(); final List jdkLocaleList = Arrays.asList(jdkLocaleArray); - final Set jdkLocaleSet = new HashSet(jdkLocaleList); + final Set jdkLocaleSet = new HashSet<>(jdkLocaleList); assertEquals(jdkLocaleSet, set); } diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java index 083264780..ad93e293b 100644 --- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java @@ -160,7 +160,7 @@ public class ObjectUtilsTest { @Test public void testHashCodeMulti_multiple_likeList() { - final List list0 = new ArrayList(Arrays.asList(new Object[0])); + final List list0 = new ArrayList<>(Arrays.asList(new Object[0])); assertEquals(list0.hashCode(), ObjectUtils.hashCodeMulti()); final List list1 = new ArrayList(Arrays.asList("a")); diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java index e4159acc0..caa648b41 100644 --- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java @@ -56,7 +56,7 @@ public class SerializationUtilsTest { public void setUp() { iString = "foo"; iInteger = Integer.valueOf(7); - iMap = new HashMap(); + iMap = new HashMap<>(); iMap.put("FOO", iString); iMap.put("BAR", iInteger); } diff --git a/src/test/java/org/apache/commons/lang3/ValidateTest.java b/src/test/java/org/apache/commons/lang3/ValidateTest.java index cd84ec33a..33b4fff12 100644 --- a/src/test/java/org/apache/commons/lang3/ValidateTest.java +++ b/src/test/java/org/apache/commons/lang3/ValidateTest.java @@ -186,7 +186,7 @@ public class ValidateTest { //----------------------------------------------------------------------- @Test public void testNotEmptyCollection1() { - final Collection coll = new ArrayList(); + final Collection coll = new ArrayList<>(); try { Validate.notEmpty((Collection) null); fail("Expecting NullPointerException"); @@ -209,7 +209,7 @@ public class ValidateTest { //----------------------------------------------------------------------- @Test public void testNotEmptyCollection2() { - final Collection coll = new ArrayList(); + final Collection coll = new ArrayList<>(); try { Validate.notEmpty((Collection) null, "MSG"); fail("Expecting NullPointerException"); @@ -233,7 +233,7 @@ public class ValidateTest { //----------------------------------------------------------------------- @Test public void testNotEmptyMap1() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); try { Validate.notEmpty((Map) null); fail("Expecting NullPointerException"); @@ -256,7 +256,7 @@ public class ValidateTest { //----------------------------------------------------------------------- @Test public void testNotEmptyMap2() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); try { Validate.notEmpty((Map) null, "MSG"); fail("Expecting NullPointerException"); @@ -590,7 +590,7 @@ public class ValidateTest { //----------------------------------------------------------------------- @Test public void testNoNullElementsCollection1() { - final List coll = new ArrayList(); + final List coll = new ArrayList<>(); coll.add("a"); coll.add("b"); Validate.noNullElements(coll); @@ -616,7 +616,7 @@ public class ValidateTest { //----------------------------------------------------------------------- @Test public void testNoNullElementsCollection2() { - final List coll = new ArrayList(); + final List coll = new ArrayList<>(); coll.add("a"); coll.add("b"); Validate.noNullElements(coll, "MSG"); @@ -703,7 +703,7 @@ public class ValidateTest { //----------------------------------------------------------------------- @Test public void testValidIndex_withMessage_collection() { - final Collection coll = new ArrayList(); + final Collection coll = new ArrayList<>(); coll.add(null); coll.add(null); Validate.validIndex(coll, 0, "Broken: "); @@ -728,7 +728,7 @@ public class ValidateTest { @Test public void testValidIndex_collection() { - final Collection coll = new ArrayList(); + final Collection coll = new ArrayList<>(); coll.add(null); coll.add(null); Validate.validIndex(coll, 0); diff --git a/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java index 636d2751f..b8fd1f1a2 100644 --- a/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/DefaultToStringStyleTest.java @@ -71,10 +71,10 @@ public class DefaultToStringStyleTest { assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString()); assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", i3, false).toString()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString()); - assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap(), false).toString()); - assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap(), true).toString()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString()); + assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString()); + assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString()); assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString()); } diff --git a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java index 88d3230b6..404c9c561 100644 --- a/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/JsonToStringStyleTest.java @@ -154,18 +154,18 @@ public class JsonToStringStyleTest { } try { - new ToStringBuilder(base).append("a", new ArrayList(), false).toString(); + new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString(); fail("Should have generated UnsupportedOperationException"); } catch (UnsupportedOperationException e) { } assertEquals( "{\"a\":[]}", - new ToStringBuilder(base).append("a", new ArrayList(), + new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); try { - new ToStringBuilder(base).append("a", new HashMap(), false).toString(); + new ToStringBuilder(base).append("a", new HashMap<>(), false).toString(); fail("Should have generated UnsupportedOperationException"); } catch (UnsupportedOperationException e) { } @@ -173,7 +173,7 @@ public class JsonToStringStyleTest { assertEquals( "{\"a\":{}}", new ToStringBuilder(base).append("a", - new HashMap(), true).toString()); + new HashMap<>(), true).toString()); try { new ToStringBuilder(base).append("a", (Object) new String[0], false).toString(); diff --git a/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java index bdfd35d16..2f85751cd 100644 --- a/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/MultiLineToStringStyleTest.java @@ -72,10 +72,10 @@ public class MultiLineToStringStyleTest { assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=3" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", i3).toString()); assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=3" + SystemUtils.LINE_SEPARATOR + " b=4" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString()); assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", i3, false).toString()); - assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString()); - assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=[]" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString()); - assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new HashMap(), false).toString()); - assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a={}" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new HashMap(), true).toString()); + assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString()); + assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=[]" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); + assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString()); + assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a={}" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString()); assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a=" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString()); assertEquals(baseStr + "[" + SystemUtils.LINE_SEPARATOR + " a={}" + SystemUtils.LINE_SEPARATOR + "]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString()); } diff --git a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java index 274b2f230..e4e428439 100644 --- a/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/MultilineRecursiveToStringStyleTest.java @@ -239,7 +239,7 @@ public class MultilineRecursiveToStringStyleTest { static class Account { Customer owner; - List transactions = new ArrayList(); + List transactions = new ArrayList<>(); public double getBalance() { double balance = 0; diff --git a/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java index 43f18afdf..73184a5d5 100644 --- a/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/NoClassNameToStringStyleTest.java @@ -70,10 +70,10 @@ public class NoClassNameToStringStyleTest { assertEquals("[a=3]", new ToStringBuilder(base).append("a", i3).toString()); assertEquals("[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString()); assertEquals("[a=]", new ToStringBuilder(base).append("a", i3, false).toString()); - assertEquals("[a=]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString()); - assertEquals("[a=[]]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString()); - assertEquals("[a=]", new ToStringBuilder(base).append("a", new HashMap(), false).toString()); - assertEquals("[a={}]", new ToStringBuilder(base).append("a", new HashMap(), true).toString()); + assertEquals("[a=]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString()); + assertEquals("[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); + assertEquals("[a=]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString()); + assertEquals("[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString()); assertEquals("[a=]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString()); assertEquals("[a={}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString()); } diff --git a/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java index 247e22a53..d5388a91b 100644 --- a/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/NoFieldNamesToStringStyleTest.java @@ -71,10 +71,10 @@ public class NoFieldNamesToStringStyleTest { assertEquals(baseStr + "[3]", new ToStringBuilder(base).append("a", i3).toString()); assertEquals(baseStr + "[3,4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString()); assertEquals(baseStr + "[]", new ToStringBuilder(base).append("a", i3, false).toString()); - assertEquals(baseStr + "[]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString()); - assertEquals(baseStr + "[[]]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString()); - assertEquals(baseStr + "[]", new ToStringBuilder(base).append("a", new HashMap(), false).toString()); - assertEquals(baseStr + "[{}]", new ToStringBuilder(base).append("a", new HashMap(), true).toString()); + assertEquals(baseStr + "[]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString()); + assertEquals(baseStr + "[[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); + assertEquals(baseStr + "[]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString()); + assertEquals(baseStr + "[{}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString()); assertEquals(baseStr + "[]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString()); assertEquals(baseStr + "[{}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString()); } diff --git a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java index fe385e3ec..bbe7d2bc0 100644 --- a/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/RecursiveToStringStyleTest.java @@ -70,10 +70,10 @@ public class RecursiveToStringStyleTest { assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString()); assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", i3, false).toString()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString()); - assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap(), false).toString()); - assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap(), true).toString()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString()); + assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString()); + assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString()); assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString()); } diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java index bcf50742f..d5249d50c 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderConcurrencyTest.java @@ -108,7 +108,7 @@ public class ReflectionToStringBuilderConcurrencyTest { return Integer.valueOf(REPEAT); } }; - final Collection> tasks = new ArrayList>(); + final Collection> tasks = new ArrayList<>(); tasks.add(consumer); tasks.add(producer); final List> futures = threadPool.invokeAll(tasks); diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java index 9e7fc0c3a..75b80b23c 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java @@ -72,7 +72,7 @@ public class ReflectionToStringBuilderExcludeTest { @Test public void test_toStringExcludeCollection() { - final List excludeList = new ArrayList(); + final List excludeList = new ArrayList<>(); excludeList.add(SECRET_FIELD); final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), excludeList); this.validateSecretFieldAbsent(toString); @@ -80,7 +80,7 @@ public class ReflectionToStringBuilderExcludeTest { @Test public void test_toStringExcludeCollectionWithNull() { - final List excludeList = new ArrayList(); + final List excludeList = new ArrayList<>(); excludeList.add(null); final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), excludeList); this.validateSecretFieldPresent(toString); @@ -88,7 +88,7 @@ public class ReflectionToStringBuilderExcludeTest { @Test public void test_toStringExcludeCollectionWithNulls() { - final List excludeList = new ArrayList(); + final List excludeList = new ArrayList<>(); excludeList.add(null); excludeList.add(null); final String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), excludeList); diff --git a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java index 7fbf50679..8cb58e5d9 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderMutateInspectConcurrencyTest.java @@ -37,7 +37,7 @@ import org.junit.Test; public class ReflectionToStringBuilderMutateInspectConcurrencyTest { class TestFixture { - final private LinkedList listField = new LinkedList(); + final private LinkedList listField = new LinkedList<>(); final private Random random = new Random(); private final int N = 100; diff --git a/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java index f4afd53ef..e27e9f10c 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ShortPrefixToStringStyleTest.java @@ -71,10 +71,10 @@ public class ShortPrefixToStringStyleTest { assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString()); assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", i3, false).toString()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString()); - assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap(), false).toString()); - assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap(), true).toString()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString()); + assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString()); + assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString()); assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString()); } diff --git a/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java index 63739b31f..1bf18db86 100644 --- a/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java @@ -70,10 +70,10 @@ public class SimpleToStringStyleTest { assertEquals("3", new ToStringBuilder(base).append("a", i3).toString()); assertEquals("3,4", new ToStringBuilder(base).append("a", i3).append("b", i4).toString()); assertEquals("", new ToStringBuilder(base).append("a", i3, false).toString()); - assertEquals("", new ToStringBuilder(base).append("a", new ArrayList(), false).toString()); - assertEquals("[]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString()); - assertEquals("", new ToStringBuilder(base).append("a", new HashMap(), false).toString()); - assertEquals("{}", new ToStringBuilder(base).append("a", new HashMap(), true).toString()); + assertEquals("", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString()); + assertEquals("[]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); + assertEquals("", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString()); + assertEquals("{}", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString()); assertEquals("", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString()); assertEquals("{}", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString()); } diff --git a/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java index 3ab17e34e..17b19d011 100644 --- a/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/StandardToStringStyleTest.java @@ -86,10 +86,10 @@ public class StandardToStringStyleTest { assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString()); assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString()); assertEquals(baseStr + "[a=%Integer%]", new ToStringBuilder(base).append("a", i3, false).toString()); - assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString()); - assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString()); - assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", new HashMap(), false).toString()); - assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap(), true).toString()); + assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString()); + assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); + assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString()); + assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString()); assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString()); assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString()); } diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java index c55fe2f19..322c204d5 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java @@ -315,7 +315,7 @@ public class ToStringBuilderTest { // representation different for IBM JDK 1.6.0, LANG-727 assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION)); assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0); - final List list = new ArrayList(); + final List list = new ArrayList<>(); final String baseString = this.toBaseString(list); final String expectedWithTransients = baseString + "[elementData={,,,,,,,,,},size=0,modCount=0]"; final String toStringWithTransients = ToStringBuilder.reflectionToString(list, null, true); @@ -624,10 +624,10 @@ public class ToStringBuilderTest { assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString()); assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", i3, false).toString()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString()); - assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap(), false).toString()); - assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap(), true).toString()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).toString()); + assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).toString()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap<>(), false).toString()); + assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).toString()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString()); assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString()); } @@ -642,10 +642,10 @@ public class ToStringBuilderTest { assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).build()); assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).build()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", i3, false).build()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList(), false).build()); - assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList(), true).build()); - assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap(), false).build()); - assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap(), true).build()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new ArrayList<>(), false).build()); + assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList<>(), true).build()); + assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", new HashMap<>(), false).build()); + assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap<>(), true).build()); assertEquals(baseStr + "[a=]", new ToStringBuilder(base).append("a", (Object) new String[0], false).build()); assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).build()); } diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java index b71466321..40dd27366 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleConcurrencyTest.java @@ -60,7 +60,7 @@ public class ToStringStyleConcurrencyTest { private static final int REPEAT = 100; static { - LIST = new ArrayList(LIST_SIZE); + LIST = new ArrayList<>(LIST_SIZE); for (int i = 0; i < LIST_SIZE; i++) { LIST.add(Integer.valueOf(i)); } @@ -99,7 +99,7 @@ public class ToStringStyleConcurrencyTest { return Integer.valueOf(REPEAT); } }; - final Collection> tasks = new ArrayList>(); + final Collection> tasks = new ArrayList<>(); tasks.add(consumer); tasks.add(consumer); final List> futures = threadPool.invokeAll(tasks); diff --git a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java index c4805998a..1a0f91111 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java @@ -222,7 +222,7 @@ public class BackgroundInitializerTest { final CountDownLatch latch1 = new CountDownLatch(1); init.shouldSleep = true; init.start(); - final AtomicReference iex = new AtomicReference(); + final AtomicReference iex = new AtomicReference<>(); final Thread getThread = new Thread() { @Override public void run() { diff --git a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java index 0c240d2c3..caad3b38d 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java @@ -38,7 +38,7 @@ public class CallableBackgroundInitializerTest { */ @Test(expected=IllegalArgumentException.class) public void testInitNullCallable() { - new CallableBackgroundInitializer(null); + new CallableBackgroundInitializer<>(null); } /** @@ -48,7 +48,7 @@ public class CallableBackgroundInitializerTest { @Test public void testInitExecutor() throws InterruptedException { final ExecutorService exec = Executors.newSingleThreadExecutor(); - final CallableBackgroundInitializer init = new CallableBackgroundInitializer( + final CallableBackgroundInitializer init = new CallableBackgroundInitializer<>( new TestCallable(), exec); assertEquals("Executor not set", exec, init.getExternalExecutor()); exec.shutdown(); @@ -79,7 +79,7 @@ public class CallableBackgroundInitializerTest { @Test public void testInitialize() throws Exception { final TestCallable call = new TestCallable(); - final CallableBackgroundInitializer init = new CallableBackgroundInitializer( + final CallableBackgroundInitializer init = new CallableBackgroundInitializer<>( call); assertEquals("Wrong result", RESULT, init.initialize()); assertEquals("Wrong number of invocations", 1, call.callCount); diff --git a/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java b/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java index 48e445114..fd5ccd5c7 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java @@ -434,7 +434,7 @@ public class ConcurrentUtilsTest { public void testPutIfAbsentKeyPresent() { final String key = "testKey"; final Integer value = 42; - final ConcurrentMap map = new ConcurrentHashMap(); + final ConcurrentMap map = new ConcurrentHashMap<>(); map.put(key, value); assertEquals("Wrong result", value, ConcurrentUtils.putIfAbsent(map, key, 0)); @@ -448,7 +448,7 @@ public class ConcurrentUtilsTest { public void testPutIfAbsentKeyNotPresent() { final String key = "testKey"; final Integer value = 42; - final ConcurrentMap map = new ConcurrentHashMap(); + final ConcurrentMap map = new ConcurrentHashMap<>(); assertEquals("Wrong result", value, ConcurrentUtils.putIfAbsent(map, key, value)); assertEquals("Wrong value in map", value, map.get(key)); @@ -477,7 +477,7 @@ public class ConcurrentUtilsTest { EasyMock.replay(init); final String key = "testKey"; final Integer value = 42; - final ConcurrentMap map = new ConcurrentHashMap(); + final ConcurrentMap map = new ConcurrentHashMap<>(); map.put(key, value); assertEquals("Wrong result", value, ConcurrentUtils.createIfAbsent(map, key, init)); @@ -500,7 +500,7 @@ public class ConcurrentUtilsTest { final Integer value = 42; EasyMock.expect(init.get()).andReturn(value); EasyMock.replay(init); - final ConcurrentMap map = new ConcurrentHashMap(); + final ConcurrentMap map = new ConcurrentHashMap<>(); assertEquals("Wrong result", value, ConcurrentUtils.createIfAbsent(map, key, init)); assertEquals("Wrong value in map", value, map.get(key)); @@ -531,7 +531,7 @@ public class ConcurrentUtilsTest { */ @Test public void testCreateIfAbsentNullInit() throws ConcurrentException { - final ConcurrentMap map = new ConcurrentHashMap(); + final ConcurrentMap map = new ConcurrentHashMap<>(); final String key = "testKey"; final Integer value = 42; map.put(key, value); @@ -547,10 +547,10 @@ public class ConcurrentUtilsTest { public void testCreateIfAbsentUncheckedSuccess() { final String key = "testKey"; final Integer value = 42; - final ConcurrentMap map = new ConcurrentHashMap(); + final ConcurrentMap map = new ConcurrentHashMap<>(); assertEquals("Wrong result", value, ConcurrentUtils.createIfAbsentUnchecked(map, key, - new ConstantInitializer(value))); + new ConstantInitializer<>(value))); assertEquals("Wrong value in map", value, map.get(key)); } diff --git a/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java index 8c09b50b4..040f66be1 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java @@ -36,7 +36,7 @@ public class ConstantInitializerTest { @Before public void setUp() throws Exception { - init = new ConstantInitializer(VALUE); + init = new ConstantInitializer<>(VALUE); } /** @@ -80,11 +80,11 @@ public class ConstantInitializerTest { @Test public void testEqualsTrue() { checkEquals(init, true); - ConstantInitializer init2 = new ConstantInitializer( + ConstantInitializer init2 = new ConstantInitializer<>( Integer.valueOf(VALUE.intValue())); checkEquals(init2, true); - init = new ConstantInitializer(null); - init2 = new ConstantInitializer(null); + init = new ConstantInitializer<>(null); + init2 = new ConstantInitializer<>(null); checkEquals(init2, true); } @@ -93,10 +93,10 @@ public class ConstantInitializerTest { */ @Test public void testEqualsFalse() { - ConstantInitializer init2 = new ConstantInitializer( + ConstantInitializer init2 = new ConstantInitializer<>( null); checkEquals(init2, false); - init2 = new ConstantInitializer(VALUE + 1); + init2 = new ConstantInitializer<>(VALUE + 1); checkEquals(init2, false); } @@ -107,7 +107,7 @@ public class ConstantInitializerTest { public void testEqualsWithOtherObjects() { checkEquals(null, false); checkEquals(this, false); - checkEquals(new ConstantInitializer("Test"), false); + checkEquals(new ConstantInitializer<>("Test"), false); } /** @@ -127,7 +127,7 @@ public class ConstantInitializerTest { */ @Test public void testToStringNull() { - final String s = new ConstantInitializer(null).toString(); + final String s = new ConstantInitializer<>(null).toString(); assertTrue("Object not found: " + s, s.indexOf("object = null") > 0); } } diff --git a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java index 8b685e928..df0ef7daa 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreakerTest.java @@ -376,7 +376,7 @@ public class EventCountCircuitBreakerTest { */ public ChangeListener(Object source) { expectedSource = source; - changedValues = new ArrayList(); + changedValues = new ArrayList<>(); } public void propertyChange(PropertyChangeEvent evt) { diff --git a/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java b/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java index 2f1ecf101..f5b74ff80 100644 --- a/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java +++ b/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java @@ -76,7 +76,7 @@ public class EventListenerSupportTest { @Test public void testEventDispatchOrder() throws PropertyVetoException { final EventListenerSupport listenerSupport = EventListenerSupport.create(VetoableChangeListener.class); - final List calledListeners = new ArrayList(); + final List calledListeners = new ArrayList<>(); final VetoableChangeListener listener1 = createListener(calledListeners); final VetoableChangeListener listener2 = createListener(calledListeners); diff --git a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java index 58c5b67e3..4c8d6153d 100644 --- a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java @@ -200,7 +200,7 @@ public class EventUtilsTest private static class EventCountingInvociationHandler implements InvocationHandler { - private final Map eventCounts = new TreeMap(); + private final Map eventCounts = new TreeMap<>(); public L createListener(final Class listenerType) { diff --git a/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java b/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java index 763b24406..5730d015c 100644 --- a/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java +++ b/src/test/java/org/apache/commons/lang3/mutable/MutableObjectTest.java @@ -32,15 +32,15 @@ public class MutableObjectTest { assertEquals(null, new MutableObject().getValue()); final Integer i = Integer.valueOf(6); - assertSame(i, new MutableObject(i).getValue()); - assertSame("HI", new MutableObject("HI").getValue()); - assertSame(null, new MutableObject(null).getValue()); + assertSame(i, new MutableObject<>(i).getValue()); + assertSame("HI", new MutableObject<>("HI").getValue()); + assertSame(null, new MutableObject<>(null).getValue()); } @Test public void testGetSet() { - final MutableObject mutNum = new MutableObject(); - assertEquals(null, new MutableObject().getValue()); + final MutableObject mutNum = new MutableObject<>(); + assertEquals(null, new MutableObject<>().getValue()); mutNum.setValue("HELLO"); assertSame("HELLO", mutNum.getValue()); @@ -51,10 +51,10 @@ public class MutableObjectTest { @Test public void testEquals() { - final MutableObject mutNumA = new MutableObject("ALPHA"); - final MutableObject mutNumB = new MutableObject("ALPHA"); - final MutableObject mutNumC = new MutableObject("BETA"); - final MutableObject mutNumD = new MutableObject(null); + final MutableObject mutNumA = new MutableObject<>("ALPHA"); + final MutableObject mutNumB = new MutableObject<>("ALPHA"); + final MutableObject mutNumC = new MutableObject<>("BETA"); + final MutableObject mutNumD = new MutableObject<>(null); assertTrue(mutNumA.equals(mutNumA)); assertTrue(mutNumA.equals(mutNumB)); @@ -73,10 +73,10 @@ public class MutableObjectTest { @Test public void testHashCode() { - final MutableObject mutNumA = new MutableObject("ALPHA"); - final MutableObject mutNumB = new MutableObject("ALPHA"); - final MutableObject mutNumC = new MutableObject("BETA"); - final MutableObject mutNumD = new MutableObject(null); + final MutableObject mutNumA = new MutableObject<>("ALPHA"); + final MutableObject mutNumB = new MutableObject<>("ALPHA"); + final MutableObject mutNumC = new MutableObject<>("BETA"); + final MutableObject mutNumD = new MutableObject<>(null); assertTrue(mutNumA.hashCode() == mutNumA.hashCode()); assertTrue(mutNumA.hashCode() == mutNumB.hashCode()); @@ -88,9 +88,9 @@ public class MutableObjectTest { @Test public void testToString() { - assertEquals("HI", new MutableObject("HI").toString()); - assertEquals("10.0", new MutableObject(Double.valueOf(10)).toString()); - assertEquals("null", new MutableObject(null).toString()); + assertEquals("HI", new MutableObject<>("HI").toString()); + assertEquals("10.0", new MutableObject<>(Double.valueOf(10)).toString()); + assertEquals("null", new MutableObject<>(null).toString()); } } diff --git a/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java index dff8a8dd2..42e1295d8 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/ConstructorUtilsTest.java @@ -116,7 +116,7 @@ public class ConstructorUtilsTest { private final Map, Class[]> classCache; public ConstructorUtilsTest() { - classCache = new HashMap, Class[]>(); + classCache = new HashMap<>(); } diff --git a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java index e2957a81e..017828b72 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/FieldUtilsTest.java @@ -160,7 +160,7 @@ public class FieldUtilsTest { final List fieldsNumber = Arrays.asList(Number.class.getDeclaredFields()); assertEquals(fieldsNumber, FieldUtils.getAllFieldsList(Number.class)); final List fieldsInteger = Arrays.asList(Integer.class.getDeclaredFields()); - final List allFieldsInteger = new ArrayList(fieldsInteger); + final List allFieldsInteger = new ArrayList<>(fieldsInteger); allFieldsInteger.addAll(fieldsNumber); assertEquals(allFieldsInteger, FieldUtils.getAllFieldsList(Integer.class)); assertEquals(5, FieldUtils.getAllFieldsList(PublicChild.class).size()); diff --git a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java index fc7800823..5e74fc93a 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java @@ -249,7 +249,7 @@ public class MethodUtilsTest { } private TestBean testBean; - private final Map, Class[]> classCache = new HashMap, Class[]>(); + private final Map, Class[]> classCache = new HashMap<>(); @Before public void setUp() throws Exception { diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java index 66477ea20..323f0ddf3 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java @@ -525,7 +525,7 @@ public class TypeUtilsTest { @Test public void testTypesSatisfyVariables() throws SecurityException, NoSuchFieldException, NoSuchMethodException { - final Map, Type> typeVarAssigns = new HashMap, Type>(); + final Map, Type> typeVarAssigns = new HashMap<>(); final Integer max = TypeUtilsTest. stub(); typeVarAssigns.put(getClass().getMethod("stub").getTypeParameters()[0], Integer.class); Assert.assertTrue(TypeUtils.typesSatisfyVariables(typeVarAssigns)); diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java index 79ff231bf..b2464ac3b 100644 --- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java @@ -45,7 +45,7 @@ import org.apache.commons.lang3.SystemUtils; */ public class ExtendedMessageFormatTest { - private final Map registry = new HashMap(); + private final Map registry = new HashMap<>(); @Before public void setUp() throws Exception { @@ -116,7 +116,7 @@ public class ExtendedMessageFormatTest { final String extendedPattern = "Name: {0,upper} "; final String pattern = extendedPattern + builtinsPattern; - final HashSet testLocales = new HashSet(); + final HashSet testLocales = new HashSet<>(); testLocales.addAll(Arrays.asList(DateFormat.getAvailableLocales())); testLocales.retainAll(Arrays.asList(NumberFormat.getAvailableLocales())); testLocales.add(null); diff --git a/src/test/java/org/apache/commons/lang3/text/StrLookupTest.java b/src/test/java/org/apache/commons/lang3/text/StrLookupTest.java index 9190185bd..737c1e12e 100644 --- a/src/test/java/org/apache/commons/lang3/text/StrLookupTest.java +++ b/src/test/java/org/apache/commons/lang3/text/StrLookupTest.java @@ -95,7 +95,7 @@ public class StrLookupTest { @Test public void testMapLookup() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("key", "value"); map.put("number", Integer.valueOf(2)); assertEquals("value", StrLookup.mapLookup(map).lookup("key")); diff --git a/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java b/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java index 2f8759f47..1623dea95 100644 --- a/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java +++ b/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java @@ -42,7 +42,7 @@ public class StrSubstitutorTest { @Before public void setUp() throws Exception { - values = new HashMap(); + values = new HashMap<>(); values.put("animal", "quick brown fox"); values.put("target", "lazy dog"); } @@ -235,7 +235,7 @@ public class StrSubstitutorTest { */ @Test public void testCyclicReplacement() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("animal", "${critter}"); map.put("target", "${pet}"); map.put("pet", "${petCharacteristic} dog"); @@ -364,7 +364,7 @@ public class StrSubstitutorTest { @Test public void testDefaultValueDelimiters() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("animal", "fox"); map.put("target", "dog"); @@ -402,7 +402,7 @@ public class StrSubstitutorTest { @Test public void testResolveVariable() { final StrBuilder builder = new StrBuilder("Hi ${name}!"); - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("name", "commons"); final StrSubstitutor sub = new StrSubstitutor(map) { @Override @@ -433,7 +433,7 @@ public class StrSubstitutorTest { */ @Test public void testConstructorMapPrefixSuffix() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("name", "commons"); final StrSubstitutor sub = new StrSubstitutor(map, "<", ">"); assertEquals("Hi < commons", sub.replace("Hi $< ")); @@ -444,7 +444,7 @@ public class StrSubstitutorTest { */ @Test public void testConstructorMapFull() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("name", "commons"); StrSubstitutor sub = new StrSubstitutor(map, "<", ">", '!'); assertEquals("Hi < commons", sub.replace("Hi !< ")); @@ -556,7 +556,7 @@ public class StrSubstitutorTest { */ @Test public void testStaticReplace() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("name", "commons"); assertEquals("Hi commons!", StrSubstitutor.replace("Hi ${name}!", map)); } @@ -566,7 +566,7 @@ public class StrSubstitutorTest { */ @Test public void testStaticReplacePrefixSuffix() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("name", "commons"); assertEquals("Hi commons!", StrSubstitutor.replace("Hi !", map, "<", ">")); } @@ -615,7 +615,7 @@ public class StrSubstitutorTest { @Test public void testSamePrefixAndSuffix() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("greeting", "Hello"); map.put(" there ", "XXX"); map.put("name", "commons"); @@ -626,7 +626,7 @@ public class StrSubstitutorTest { @Test public void testSubstitutePreserveEscape() { final String org = "${not-escaped} $${escaped}"; - final Map map = new HashMap(); + final Map map = new HashMap<>(); map.put("not-escaped", "value"); StrSubstitutor sub = new StrSubstitutor(map, "${", "}", '$'); @@ -678,7 +678,7 @@ public class StrSubstitutorTest { } // replace using object - final MutableObject obj = new MutableObject(replaceTemplate); // toString returns template + final MutableObject obj = new MutableObject<>(replaceTemplate); // toString returns template assertEquals(expectedResult, sub.replace(obj)); // replace in StringBuffer diff --git a/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java b/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java index 2d33b7bfc..b251516d3 100644 --- a/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java +++ b/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java @@ -37,8 +37,8 @@ public class EntityArraysTest { // LANG-659 - check arrays for duplicate entries @Test public void testHTML40_EXTENDED_ESCAPE(){ - final Set col0 = new HashSet(); - final Set col1 = new HashSet(); + final Set col0 = new HashSet<>(); + final Set col1 = new HashSet<>(); final String [][] sa = EntityArrays.HTML40_EXTENDED_ESCAPE(); for(int i =0; i col0 = new HashSet(); - final Set col1 = new HashSet(); + final Set col0 = new HashSet<>(); + final Set col1 = new HashSet<>(); final String [][] sa = EntityArrays.ISO8859_1_ESCAPE(); boolean success = true; for(int i =0; i map= new HashMap(); + final Map map= new HashMap<>(); int i= 0; for(final DateParser parser:parsers) { map.put(parser, Integer.valueOf(i++)); diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java index 3ae5f5625..e669a24e2 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java @@ -37,7 +37,7 @@ public class FastDatePrinterTimeZonesTest { @Parameterized.Parameters public static Collection data() { final String[] zoneIds = TimeZone.getAvailableIDs(); - List timeZones = new ArrayList(); + List timeZones = new ArrayList<>(); for (String zoneId : zoneIds) { timeZones.add(TimeZone.getTimeZone(zoneId)); } diff --git a/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java b/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java index 462122ce7..f73d7b590 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java @@ -35,12 +35,12 @@ public class ImmutablePairTest { @Test public void testBasic() throws Exception { - final ImmutablePair pair = new ImmutablePair(0, "foo"); + final ImmutablePair pair = new ImmutablePair<>(0, "foo"); assertEquals(0, pair.left.intValue()); assertEquals(0, pair.getLeft().intValue()); assertEquals("foo", pair.right); assertEquals("foo", pair.getRight()); - final ImmutablePair pair2 = new ImmutablePair(null, "bar"); + final ImmutablePair pair2 = new ImmutablePair<>(null, "bar"); assertNull(pair2.left); assertNull(pair2.getLeft()); assertEquals("bar", pair2.right); diff --git a/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java b/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java index 42b5ed625..3e36932e0 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java @@ -35,14 +35,14 @@ public class ImmutableTripleTest { @Test public void testBasic() throws Exception { - final ImmutableTriple triple = new ImmutableTriple(0, "foo", Boolean.TRUE); + final ImmutableTriple triple = new ImmutableTriple<>(0, "foo", Boolean.TRUE); assertEquals(0, triple.left.intValue()); assertEquals(0, triple.getLeft().intValue()); assertEquals("foo", triple.middle); assertEquals("foo", triple.getMiddle()); assertEquals(Boolean.TRUE, triple.right); assertEquals(Boolean.TRUE, triple.getRight()); - final ImmutableTriple triple2 = new ImmutableTriple(null, "bar", 42); + final ImmutableTriple triple2 = new ImmutableTriple<>(null, "bar", 42); assertNull(triple2.left); assertNull(triple2.getLeft()); assertEquals("bar", triple2.middle); diff --git a/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java b/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java index 11daffeef..b8eed248e 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java @@ -35,24 +35,24 @@ public class MutablePairTest { @Test public void testBasic() throws Exception { - final MutablePair pair = new MutablePair(0, "foo"); + final MutablePair pair = new MutablePair<>(0, "foo"); assertEquals(0, pair.getLeft().intValue()); assertEquals("foo", pair.getRight()); - final MutablePair pair2 = new MutablePair(null, "bar"); + final MutablePair pair2 = new MutablePair<>(null, "bar"); assertNull(pair2.getLeft()); assertEquals("bar", pair2.getRight()); } @Test public void testDefault() throws Exception { - final MutablePair pair = new MutablePair(); + final MutablePair pair = new MutablePair<>(); assertNull(pair.getLeft()); assertNull(pair.getRight()); } @Test public void testMutate() throws Exception { - final MutablePair pair = new MutablePair(0, "foo"); + final MutablePair pair = new MutablePair<>(0, "foo"); pair.setLeft(42); pair.setRight("bar"); assertEquals(42, pair.getLeft().intValue()); diff --git a/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java b/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java index 002b697e3..dc18ddb3d 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java @@ -35,11 +35,11 @@ public class MutableTripleTest { @Test public void testBasic() throws Exception { - final MutableTriple triple = new MutableTriple(0, "foo", Boolean.FALSE); + final MutableTriple triple = new MutableTriple<>(0, "foo", Boolean.FALSE); assertEquals(0, triple.getLeft().intValue()); assertEquals("foo", triple.getMiddle()); assertEquals(Boolean.FALSE, triple.getRight()); - final MutableTriple triple2 = new MutableTriple(null, "bar", "hello"); + final MutableTriple triple2 = new MutableTriple<>(null, "bar", "hello"); assertNull(triple2.getLeft()); assertEquals("bar", triple2.getMiddle()); assertEquals("hello", triple2.getRight()); @@ -47,7 +47,7 @@ public class MutableTripleTest { @Test public void testDefault() throws Exception { - final MutableTriple triple = new MutableTriple(); + final MutableTriple triple = new MutableTriple<>(); assertNull(triple.getLeft()); assertNull(triple.getMiddle()); assertNull(triple.getRight()); @@ -55,7 +55,7 @@ public class MutableTripleTest { @Test public void testMutate() throws Exception { - final MutableTriple triple = new MutableTriple(0, "foo", Boolean.TRUE); + final MutableTriple triple = new MutableTriple<>(0, "foo", Boolean.TRUE); triple.setLeft(42); triple.setMiddle("bar"); triple.setRight(Boolean.FALSE); diff --git a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java index 4f52a83f5..3591373ea 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/PairTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/PairTest.java @@ -51,7 +51,7 @@ public class PairTest { final Pair pair2 = MutablePair.of(0, "foo"); assertEquals(pair, pair2); assertEquals(pair.hashCode(), pair2.hashCode()); - final HashSet> set = new HashSet>(); + final HashSet> set = new HashSet<>(); set.add(pair); assertTrue(set.contains(pair2)); @@ -63,7 +63,7 @@ public class PairTest { @Test public void testMapEntry() throws Exception { final Pair pair = ImmutablePair.of(0, "foo"); - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put(0, "foo"); final Entry entry = map.entrySet().iterator().next(); assertEquals(pair, entry); diff --git a/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java b/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java index 6f915c91d..246679077 100644 --- a/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java +++ b/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java @@ -50,7 +50,7 @@ public class TripleTest { final Triple triple2 = MutableTriple.of(0, "foo", Boolean.TRUE); assertEquals(triple, triple2); assertEquals(triple.hashCode(), triple2.hashCode()); - final HashSet> set = new HashSet>(); + final HashSet> set = new HashSet<>(); set.add(triple); assertTrue(set.contains(triple2)); }