diff options
Diffstat (limited to 'plugins/org.eclipse.net4j.util/src/org')
74 files changed, 211 insertions, 210 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractBundle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractBundle.java index 943c694a8b..f5c459cdeb 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractBundle.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractBundle.java @@ -57,7 +57,7 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, private boolean debugging; - private Map<String, Tracer> tracers = new ConcurrentHashMap<String, Tracer>(0); + private Map<String, Tracer> tracers = new ConcurrentHashMap<>(0); private OMLogger logger; @@ -67,9 +67,9 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, private ResourceBundle untranslatedResourceBundle; - private Map<String, String> strings = new HashMap<String, String>(0); + private Map<String, String> strings = new HashMap<>(0); - private Map<String, String> untranslatedStrings = new HashMap<String, String>(0); + private Map<String, String> untranslatedStrings = new HashMap<>(0); private boolean shouldTranslate = true; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java index 2a2505e72c..3a830fcf96 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java @@ -48,7 +48,7 @@ public abstract class AbstractPlatform implements OMPlatform private static ContextTracer __TRACER__; - private Map<String, AbstractBundle> bundles = new ConcurrentHashMap<String, AbstractBundle>(0); + private Map<String, AbstractBundle> bundles = new ConcurrentHashMap<>(0); private ConcurrentArray<OMLogFilter> logFilters = new ConcurrentArray.Unique<OMLogFilter>() { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/PluginElementProcessorList.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/PluginElementProcessorList.java index 44457184b6..f0d2a7b72c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/PluginElementProcessorList.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/PluginElementProcessorList.java @@ -31,7 +31,7 @@ public class PluginElementProcessorList extends Lifecycle implements List<IEleme public static final String EXT_POINT = "elementProcessors"; //$NON-NLS-1$ - private List<IElementProcessor> processors = new ArrayList<IElementProcessor>(); + private List<IElementProcessor> processors = new ArrayList<>(); private Object extensionRegistryListener; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java index 9b176b55dd..5705b81738 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java @@ -81,7 +81,7 @@ public class LegacyBundle extends AbstractBundle @Override public Iterator<Class<?>> getClasses() { - List<Class<?>> result = new ArrayList<Class<?>>(); + List<Class<?>> result = new ArrayList<>(); if (isArchiveProtocol(baseURL.getProtocol())) { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java index 569f0a9735..af7f1b6dd6 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java @@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap; */ public class LegacyPlatform extends AbstractPlatform { - private Map<String, String> debugOptions = new ConcurrentHashMap<String, String>(0); + private Map<String, String> debugOptions = new ConcurrentHashMap<>(0); public LegacyPlatform() { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiBundle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiBundle.java index 3481b27d98..a784536219 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiBundle.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiBundle.java @@ -68,7 +68,7 @@ public class OSGiBundle extends AbstractBundle @Override public Iterator<Class<?>> getClasses() { - final Queue<String> folders = new LinkedList<String>(); + final Queue<String> folders = new LinkedList<>(); folders.offer("/"); return new AbstractIterator<Class<?>>() diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preferences.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preferences.java index 866c13f8c7..7b35603a63 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preferences.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preferences.java @@ -34,7 +34,7 @@ public class Preferences extends Notifier implements OMPreferences { private AbstractBundle bundle; - private Map<String, Preference<?>> prefs = new HashMap<String, Preference<?>>(); + private Map<String, Preference<?>> prefs = new HashMap<>(); private boolean loaded; @@ -299,7 +299,7 @@ public class Preferences extends Notifier implements OMPreferences IListener[] listeners = getListeners(); if (listeners != null) { - fireEvent(new PreferencesChangeEvent<T>(preference, oldValue, newValue), listeners); + fireEvent(new PreferencesChangeEvent<>(preference, oldValue, newValue), listeners); } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/AbstractRange.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/AbstractRange.java index 3281c7796a..7d3f765fc5 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/AbstractRange.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/AbstractRange.java @@ -34,7 +34,7 @@ public abstract class AbstractRange implements Range @Override public Set<Cell> set() { - Set<Cell> set = new HashSet<Cell>(); + Set<Cell> set = new HashSet<>(); fillCells(set); return set; } @@ -42,7 +42,7 @@ public abstract class AbstractRange implements Range @Override public List<Cell> list() { - List<Cell> list = new ArrayList<Cell>(); + List<Cell> list = new ArrayList<>(); fillCells(list); return list; } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/ComposedRange.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/ComposedRange.java index 2bd5f71622..8d1be7672f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/ComposedRange.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/ComposedRange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2014, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,9 +28,9 @@ final class ComposedRange extends AbstractRange { final Table table; - final List<Range> inclusions = new ArrayList<Range>(); + final List<Range> inclusions = new ArrayList<>(); - final List<Range> exclusions = new ArrayList<Range>(); + final List<Range> exclusions = new ArrayList<>(); public ComposedRange(ComposedRange source) { @@ -76,7 +76,7 @@ final class ComposedRange extends AbstractRange Iterator<Cell> iterator = ComposedIterator.fromIterables(inclusions); if (!exclusions.isEmpty()) { - Set<Cell> excludedCells = new HashSet<Cell>(); + Set<Cell> excludedCells = new HashSet<>(); for (Range range : exclusions) { for (Cell cell : range) @@ -85,10 +85,10 @@ final class ComposedRange extends AbstractRange } } - iterator = new PredicateIterator<Cell>(Predicates.excluded(excludedCells), iterator); + iterator = new PredicateIterator<>(Predicates.excluded(excludedCells), iterator); } - return new PredicateIterator<Cell>(Predicates.unique(), iterator); + return new PredicateIterator<>(Predicates.unique(), iterator); } private static void addRanges(List<Range> list, Range... ranges) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java index 1976beeeab..b007c182e3 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java @@ -28,7 +28,7 @@ public final class Predicates */ public static <T> Predicate<T> included(Set<T> inclusions) { - return new IncludedPredicate<T>(inclusions); + return new IncludedPredicate<>(inclusions); } /** @@ -36,7 +36,7 @@ public final class Predicates */ public static <T> Predicate<T> excluded(Set<T> exclusions) { - return new ExcludedPredicate<T>(exclusions); + return new ExcludedPredicate<>(exclusions); } /** @@ -44,7 +44,7 @@ public final class Predicates */ public static <T> Predicate<T> unique() { - return new UniquePredicate<T>(); + return new UniquePredicate<>(); } @SuppressWarnings("unchecked") @@ -105,7 +105,7 @@ public final class Predicates */ public static final class UniquePredicate<T> implements Predicate<T> { - private final Set<T> applied = new HashSet<T>(); + private final Set<T> applied = new HashSet<>(); @Override public boolean apply(T element) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ReflectUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ReflectUtil.java index 91f925b070..8c6d91ef1b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ReflectUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ReflectUtil.java @@ -51,7 +51,7 @@ public final class ReflectUtil private static final Method HASH_CODE_METHOD = lookupHashCodeMethod(); - private static final Map<Object, Long> ids = new WeakHashMap<Object, Long>(); + private static final Map<Object, Long> ids = new WeakHashMap<>(); private static final Long FAKE_ID = 0L; @@ -404,7 +404,7 @@ public final class ReflectUtil @SuppressWarnings("unchecked") public static Pair<Field, Object>[] dumpToArray(Object object) { - List<Field> fields = new ArrayList<Field>(); + List<Field> fields = new ArrayList<>(); collectFields(object.getClass(), fields); Pair<Field, Object>[] result = new Pair[fields.size()]; int i = 0; @@ -433,7 +433,7 @@ public final class ReflectUtil } String className = null; - Map<String, Object> values = new HashMap<String, Object>(); + Map<String, Object> values = new HashMap<>(); for (Entry<Object, Object> entry : properties.entrySet()) { if (entry.getKey() instanceof String) @@ -684,7 +684,7 @@ public final class ReflectUtil VOID(void.class), // NONE(null); - private static final Map<Class<?>, PrimitiveType> INSTANCES = new HashMap<Class<?>, PrimitiveType>(); + private static final Map<Class<?>, PrimitiveType> INSTANCES = new HashMap<>(); private final Class<?> type; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/StringUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/StringUtil.java index df9f9ed593..4fa9f5c935 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/StringUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/StringUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2013, 2015, 2016, 2018 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2013, 2015, 2016, 2018, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -80,7 +80,7 @@ public final class StringUtil */ public static List<String> split(String text, String separators, String brackets) { - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); StringBuilder builder = new StringBuilder(); int length = text.length(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/Cache.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/Cache.java index 63b3f543bf..6dea358343 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/Cache.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/Cache.java @@ -28,7 +28,7 @@ public abstract class Cache<E> extends Worker implements ICache private ICacheProbe cacheProbe; - private ReferenceQueue<E> referenceQueue = new ReferenceQueue<E>(); + private ReferenceQueue<E> referenceQueue = new ReferenceQueue<>(); public Cache() { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheMonitor.java index 3ba129de81..6ea3807631 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheMonitor.java @@ -46,7 +46,7 @@ public class CacheMonitor extends Worker implements ICacheMonitor private Condition condition; - private Map<ICache, ICacheRegistration> registrations = new HashMap<ICache, ICacheRegistration>(); + private Map<ICache, ICacheRegistration> registrations = new HashMap<>(); public CacheMonitor() { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidiMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidiMap.java index d95f2f1a95..fb3ce2708b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidiMap.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidiMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,7 +44,7 @@ public class BidiMap<K, V> extends AbstractMap<K, V> public BidiMap(Class<K> keyClass, Class<V> valueClass) { - this(keyClass, valueClass, new HashMap<Object, Object>()); + this(keyClass, valueClass, new HashMap<>()); } public final Class<K> getKeyClass() @@ -59,7 +59,7 @@ public class BidiMap<K, V> extends AbstractMap<K, V> public final Map<V, K> invert() { - return new BidiMap<V, K>(valueClass, keyClass, map); + return new BidiMap<>(valueClass, keyClass, map); } @Override diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidiMapper.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidiMapper.java index 9ca722f55c..85a0afa8fa 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidiMapper.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidiMapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,9 +21,9 @@ import java.util.Map; @Deprecated public class BidiMapper<T1, T2> { - private Map<T1, T2> map1 = new HashMap<T1, T2>(); + private Map<T1, T2> map1 = new HashMap<>(); - private Map<T2, T1> map2 = new HashMap<T2, T1>(); + private Map<T2, T1> map2 = new HashMap<>(); public BidiMapper() { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ByteArrayWrapper.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ByteArrayWrapper.java index 03fa3c477f..1014b2e453 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ByteArrayWrapper.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ByteArrayWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -65,7 +65,7 @@ public final class ByteArrayWrapper return null; } - Set<byte[]> result = new HashSet<byte[]>(); + Set<byte[]> result = new HashSet<>(); for (ByteArrayWrapper wrapper : wrappers) { result.add(wrapper.getData()); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/CaseInsensitiveStringSet.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/CaseInsensitiveStringSet.java index dae9873612..1821fb8337 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/CaseInsensitiveStringSet.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/CaseInsensitiveStringSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -116,7 +116,7 @@ public class CaseInsensitiveStringSet extends HashSet<String> protected Collection<?> convert(Collection<?> c) { - Collection<Object> list = new ArrayList<Object>(); + Collection<Object> list = new ArrayList<>(); for (Iterator<?> it = c.iterator(); it.hasNext();) { Object o = it.next(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/CollectionUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/CollectionUtil.java index 3c645cf796..cc4990d269 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/CollectionUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/CollectionUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2015, 2018, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,7 +28,7 @@ public final class CollectionUtil public static <T> Iterator<T> dump(Iterator<T> it) { - List<T> list = new ArrayList<T>(); + List<T> list = new ArrayList<>(); while (it.hasNext()) { list.add(it.next()); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ComposedIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ComposedIterator.java index 3d217077c2..277dcd3783 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ComposedIterator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ComposedIterator.java @@ -68,12 +68,12 @@ public class ComposedIterator<T> extends AbstractIterator<T> public static <T> Iterator<T> fromIterables(Collection<? extends Iterable<T>> iterables) { - List<Iterator<T>> iterators = new ArrayList<Iterator<T>>(); + List<Iterator<T>> iterators = new ArrayList<>(); for (Iterable<T> iterable : iterables) { iterators.add(iterable.iterator()); } - return new ComposedIterator<T>(iterators.iterator()); + return new ComposedIterator<>(iterators.iterator()); } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/GrowingRandomAccessList.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/GrowingRandomAccessList.java index 28d5f4e52a..964b09f45c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/GrowingRandomAccessList.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/GrowingRandomAccessList.java @@ -30,7 +30,7 @@ public class GrowingRandomAccessList<E> extends AbstractList<E> implements Queue private final int pageCapacity; - private List<E[]> pages = new ArrayList<E[]>(); + private List<E[]> pages = new ArrayList<>(); private int firstFree; @@ -145,7 +145,7 @@ public class GrowingRandomAccessList<E> extends AbstractList<E> implements Queue } else { - GrowingRandomAccessList<E> result = new GrowingRandomAccessList<E>(componentType, pageCapacity); + GrowingRandomAccessList<E> result = new GrowingRandomAccessList<>(componentType, pageCapacity); for (int i = 0; i < size; i++) { E e = get(i); @@ -315,7 +315,7 @@ public class GrowingRandomAccessList<E> extends AbstractList<E> implements Queue public Iterator<E> descendingIterator() { ListIterator<E> delegate = listIterator(size() - 1); - return new BidirectionalIterator<E>(delegate, true); + return new BidirectionalIterator<>(delegate, true); } protected E[] createPage() diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java index 4c2b57d4d7..4572227894 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java @@ -25,22 +25,22 @@ public final class HashBag<T> implements Set<T> public HashBag() { - map = new HashMap<T, Counter>(); + map = new HashMap<>(); } public HashBag(int initialCapacity, float loadFactor) { - map = new HashMap<T, Counter>(initialCapacity, loadFactor); + map = new HashMap<>(initialCapacity, loadFactor); } public HashBag(int initialCapacity) { - map = new HashMap<T, Counter>(initialCapacity); + map = new HashMap<>(initialCapacity); } public HashBag(Map<? extends T, ? extends Counter> m) { - map = new HashMap<T, Counter>(m); + map = new HashMap<>(m); } /** diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/History.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/History.java index 638050b61d..17cb7d51e1 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/History.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/History.java @@ -22,7 +22,7 @@ import java.util.List; */ public class History<T> extends Notifier implements IHistory<T> { - protected List<IHistoryElement<T>> elements = new ArrayList<IHistoryElement<T>>(0); + protected List<IHistoryElement<T>> elements = new ArrayList<>(0); private boolean loaded; @@ -40,7 +40,7 @@ public class History<T> extends Notifier implements IHistory<T> { if (newElements == null) { - newElements = new ArrayList<IHistoryElement<T>>(0); + newElements = new ArrayList<>(0); } if (!elements.equals(newElements)) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HistoryUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HistoryUtil.java index 991ebd01a4..d9d7d99d35 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HistoryUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HistoryUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,7 +23,7 @@ public final class HistoryUtil public static IHistory<String> createHistory() { - return new History<String>(); + return new History<>(); } public static IHistory<String> createPreferenceHistory(OMPreference<String[]> preference) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MultiMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MultiMap.java index b2ef17e752..1b4a4b5e90 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MultiMap.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MultiMap.java @@ -285,7 +285,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> protected List<Map<K, V>> createDelegates() { - return new ArrayList<Map<K, V>>(); + return new ArrayList<>(); } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/Pair.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/Pair.java index 3506a95b8c..6cf0cc09f8 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/Pair.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/Pair.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011-2013 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011-2013, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -103,7 +103,7 @@ public class Pair<T1, T2> */ public Pair<T1, T2> copy() { - return new Pair<T1, T2>(this); + return new Pair<>(this); } /** @@ -111,7 +111,7 @@ public class Pair<T1, T2> */ public static <T1, T2> Pair<T1, T2> create() { - return new Pair<T1, T2>(); + return new Pair<>(); } /** @@ -119,6 +119,6 @@ public class Pair<T1, T2> */ public static <T1, T2> Pair<T1, T2> create(T1 element1, T2 element2) { - return new Pair<T1, T2>(element1, element2); + return new Pair<>(element1, element2); } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinBlockingQueue.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinBlockingQueue.java index f49d3ed691..61e81bcb3f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinBlockingQueue.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinBlockingQueue.java @@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit; */ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> { - private BlockingQueue<Entry<E>> list = new LinkedBlockingQueue<Entry<E>>(); + private BlockingQueue<Entry<E>> list = new LinkedBlockingQueue<>(); public RoundRobinBlockingQueue() { @@ -76,7 +76,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } - return list.add(new Entry<E>(e)); + return list.add(new Entry<>(e)); } } @@ -233,7 +233,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> @Override public Iterator<E> iterator() { - List<E> copy = new ArrayList<E>(); + List<E> copy = new ArrayList<>(); synchronized (list) { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/CompletionWorkSerializer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/CompletionWorkSerializer.java index 604d59b6f1..a3c169e589 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/CompletionWorkSerializer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/CompletionWorkSerializer.java @@ -32,12 +32,12 @@ public class CompletionWorkSerializer implements IWorkSerializer public CompletionWorkSerializer(Executor executor, BlockingQueue<Future<Object>> completionQueue) { - this(new ExecutorCompletionService<Object>(executor, completionQueue)); + this(new ExecutorCompletionService<>(executor, completionQueue)); } public CompletionWorkSerializer(Executor executor) { - this(new ExecutorCompletionService<Object>(executor)); + this(new ExecutorCompletionService<>(executor)); } public CompletionWorkSerializer() diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegableReentrantLock.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegableReentrantLock.java index ae336e9a2b..c011746d8c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegableReentrantLock.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegableReentrantLock.java @@ -49,7 +49,7 @@ public class DelegableReentrantLock extends NonFairReentrantLock implements ILif } }; - private final List<DelegateDetector> delegateDetectors = new CopyOnWriteArrayList<DelegateDetector>(); + private final List<DelegateDetector> delegateDetectors = new CopyOnWriteArrayList<>(); private volatile boolean active; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorWorkSerializer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorWorkSerializer.java index d7f2cb7689..3346d087d2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorWorkSerializer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorWorkSerializer.java @@ -26,7 +26,7 @@ import java.util.concurrent.Executor; @Deprecated public class ExecutorWorkSerializer extends Lifecycle implements IWorkSerializer { - private final Queue<Runnable> workQueue = new LinkedList<Runnable>(); + private final Queue<Runnable> workQueue = new LinkedList<>(); private Executor executor; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/MonitoredThread.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/MonitoredThread.java index 7d126ad143..9d7dba3ec7 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/MonitoredThread.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/MonitoredThread.java @@ -123,7 +123,7 @@ public abstract class MonitoredThread extends Thread private CountDownLatch startLatch; - private List<MonitoredThread> threads = new ArrayList<MonitoredThread>(); + private List<MonitoredThread> threads = new ArrayList<>(); /** * @param idleTimeOut @@ -200,7 +200,7 @@ public abstract class MonitoredThread extends Thread for (;;) { - List<MonitoredThread> idleThreads = new ArrayList<MonitoredThread>(); + List<MonitoredThread> idleThreads = new ArrayList<>(); synchronized (threads) { if (threads.isEmpty()) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/PriorityQueueRunner.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/PriorityQueueRunner.java index 16bd03c5b3..270efa34d9 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/PriorityQueueRunner.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/PriorityQueueRunner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,6 +26,6 @@ public class PriorityQueueRunner extends QueueRunner2<PriorityQueueRunnable> @Override protected BlockingQueue<PriorityQueueRunnable> createQueue() { - return new PriorityBlockingQueue<PriorityQueueRunnable>(); + return new PriorityBlockingQueue<>(); } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorker.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorker.java index cf7004badb..51f8eabbe0 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorker.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010-2013 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2010-2013, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -102,7 +102,7 @@ public abstract class QueueWorker<E> extends Worker protected BlockingQueue<E> createQueue() { - return new LinkedBlockingQueue<E>(); + return new LinkedBlockingQueue<>(); } /** diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWLockManager.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWLockManager.java index 7ea991c73c..6efd475e4d 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWLockManager.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWLockManager.java @@ -115,7 +115,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock } }; - private Map<OBJECT, LockEntry<OBJECT, CONTEXT>> lockEntries = new HashMap<OBJECT, LockEntry<OBJECT, CONTEXT>>(); + private Map<OBJECT, LockEntry<OBJECT, CONTEXT>> lockEntries = new HashMap<>(); private LockChanged lockChanged = new LockChanged(); @@ -161,8 +161,8 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock { synchronized (lockChanged) { - List<LockEntry<OBJECT, CONTEXT>> lockEntrysToRemove = new ArrayList<LockEntry<OBJECT, CONTEXT>>(); - List<LockEntry<OBJECT, CONTEXT>> lockEntrysToAdd = new ArrayList<LockEntry<OBJECT, CONTEXT>>(); + List<LockEntry<OBJECT, CONTEXT>> lockEntrysToRemove = new ArrayList<>(); + List<LockEntry<OBJECT, CONTEXT>> lockEntrysToAdd = new ArrayList<>(); for (Entry<OBJECT, LockEntry<OBJECT, CONTEXT>> entry : lockEntries.entrySet()) { @@ -290,8 +290,8 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock { synchronized (lockChanged) { - List<LockEntry<OBJECT, CONTEXT>> lockEntrysToRemove = new ArrayList<LockEntry<OBJECT, CONTEXT>>(); - List<LockEntry<OBJECT, CONTEXT>> lockEntrysToAdd = new ArrayList<LockEntry<OBJECT, CONTEXT>>(); + List<LockEntry<OBJECT, CONTEXT>> lockEntrysToRemove = new ArrayList<>(); + List<LockEntry<OBJECT, CONTEXT>> lockEntrysToAdd = new ArrayList<>(); for (OBJECT objectToLock : objectsToLock) { LockEntry<OBJECT, CONTEXT> entry = lockEntries.get(objectToLock); @@ -368,13 +368,13 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock private OBJECT obtainLock(LockStrategy<OBJECT, CONTEXT> lockingStrategy, CONTEXT context, Collection<? extends OBJECT> objectsToLock) { - List<LockEntry<OBJECT, CONTEXT>> lockEntrys = new ArrayList<LockEntry<OBJECT, CONTEXT>>(); + List<LockEntry<OBJECT, CONTEXT>> lockEntrys = new ArrayList<>(); for (OBJECT objectToLock : objectsToLock) { LockEntry<OBJECT, CONTEXT> entry = lockEntries.get(objectToLock); if (entry == null) { - entry = new NoLockEntry<OBJECT, CONTEXT>(objectToLock); + entry = new NoLockEntry<>(objectToLock); } if (lockingStrategy.canObtainLock(entry, context)) @@ -477,7 +477,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock { private OBJECT object; - private Set<CONTEXT> contexts = new HashBag<CONTEXT>(); + private Set<CONTEXT> contexts = new HashBag<>(); public ReadLockEntry(OBJECT objectToLock, CONTEXT context) { @@ -542,7 +542,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock @Override public LockEntry<OBJECT, CONTEXT> writeLock(CONTEXT context) { - return new WriteLockEntry<OBJECT, CONTEXT>(object, context, this); + return new WriteLockEntry<>(object, context, this); } @Override @@ -729,7 +729,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock { if (readLock == null) { - readLock = new ReadLockEntry<OBJECT, CONTEXT>(object, context); + readLock = new ReadLockEntry<>(object, context); } return readLock; @@ -793,13 +793,13 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock @Override public LockEntry<OBJECT, CONTEXT> readLock(CONTEXT context) { - return new ReadLockEntry<OBJECT, CONTEXT>(object, context); + return new ReadLockEntry<>(object, context); } @Override public LockEntry<OBJECT, CONTEXT> writeLock(CONTEXT context) { - return new WriteLockEntry<OBJECT, CONTEXT>(object, context, null); + return new WriteLockEntry<>(object, context, null); } @Override diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java index 9e27bd6714..6659e0dca5 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java @@ -40,7 +40,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo { private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_CONCURRENCY, RWOLockManager.class); - private static final ThreadLocal<Boolean> UNLOCK_ALL = new ThreadLocal<Boolean>(); + private static final ThreadLocal<Boolean> UNLOCK_ALL = new ThreadLocal<>(); private static final LockType[] ALL_LOCK_TYPES = LockType.values(); @@ -141,7 +141,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo TRACER.format("Unlock: {0} --> {1}", context, objectsToUnlock); //$NON-NLS-1$ } - Set<LockState<OBJECT, CONTEXT>> result = new HashSet<LockState<OBJECT, CONTEXT>>(); + Set<LockState<OBJECT, CONTEXT>> result = new HashSet<>(); boolean unlockAll = UNLOCK_ALL.get() == Boolean.TRUE; synchronized (this) @@ -183,7 +183,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo notifyAll(); } - return new LinkedList<RWOLockManager.LockState<OBJECT, CONTEXT>>(result); + return new LinkedList<>(result); } @Override @@ -206,7 +206,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo TRACER.format("Unlock: {0} --> {1}", context, lockStates); //$NON-NLS-1$ } - List<OBJECT> objectsWithoutLocks = new LinkedList<OBJECT>(); + List<OBJECT> objectsWithoutLocks = new LinkedList<>(); for (LockState<OBJECT, CONTEXT> lockState : lockStates) { @@ -273,12 +273,12 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo protected Map<OBJECT, LockState<OBJECT, CONTEXT>> createObjectToLocksMap() { - return new HashMap<OBJECT, LockState<OBJECT, CONTEXT>>(); + return new HashMap<>(); } protected Map<CONTEXT, Set<LockState<OBJECT, CONTEXT>>> createContextToLocksMap() { - return new HashMap<CONTEXT, Set<LockState<OBJECT, CONTEXT>>>(); + return new HashMap<>(); } /** @@ -307,7 +307,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo */ public synchronized List<LockState<OBJECT, CONTEXT>> getLockStates() { - return new ArrayList<RWOLockManager.LockState<OBJECT, CONTEXT>>(objectToLockStateMap.values()); + return new ArrayList<>(objectToLockStateMap.values()); } public synchronized void setLockState(OBJECT key, LockState<OBJECT, CONTEXT> lockState) @@ -337,7 +337,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo LockState<OBJECT, CONTEXT> lockState = objectToLockStateMap.get(o); if (lockState == null) { - lockState = new LockState<OBJECT, CONTEXT>(o); + lockState = new LockState<>(o); objectToLockStateMap.put(o, lockState); } @@ -347,7 +347,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo private ArrayList<LockState<OBJECT, CONTEXT>> getLockStatesForContext(LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToLock) { int count = objectsToLock.size(); - ArrayList<LockState<OBJECT, CONTEXT>> lockStates = new ArrayList<LockState<OBJECT, CONTEXT>>(count); + ArrayList<LockState<OBJECT, CONTEXT>> lockStates = new ArrayList<>(count); Iterator<? extends OBJECT> it = objectsToLock.iterator(); @@ -371,7 +371,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo Set<LockState<OBJECT, CONTEXT>> lockStates = contextToLockStates.get(context); if (lockStates == null) { - lockStates = new HashSet<LockState<OBJECT, CONTEXT>>(); + lockStates = new HashSet<>(); contextToLockStates.put(context, lockStates); } @@ -420,7 +420,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo return (List<LockState<OBJECT, CONTEXT>>)lockStates; } - List<LockState<OBJECT, CONTEXT>> list = new LinkedList<LockState<OBJECT, CONTEXT>>(); + List<LockState<OBJECT, CONTEXT>> list = new LinkedList<>(); for (LockState<OBJECT, CONTEXT> lockState : lockStates) { list.add(lockState); @@ -465,7 +465,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo { private final OBJECT lockedObject; - private final HashBag<CONTEXT> readLockOwners = new HashBag<CONTEXT>(); + private final HashBag<CONTEXT> readLockOwners = new HashBag<>(); private CONTEXT writeLockOwner; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SerializingExecutor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SerializingExecutor.java index 9be6da371a..b30f445ed2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SerializingExecutor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SerializingExecutor.java @@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicBoolean; */ public class SerializingExecutor extends Lifecycle implements Executor, Runnable { - private final Queue<Runnable> tasks = new ConcurrentLinkedQueue<Runnable>(); + private final Queue<Runnable> tasks = new ConcurrentLinkedQueue<>(); private final AtomicBoolean running = new AtomicBoolean(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java index 5c2b0496dc..46971bcd50 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java @@ -18,7 +18,7 @@ import java.util.concurrent.ConcurrentMap; */ public class SynchronizingCorrelator<CORRELATION, RESULT> implements ICorrelator<CORRELATION, ISynchronizer<RESULT>> { - private ConcurrentMap<CORRELATION, ISynchronizer<RESULT>> map = new ConcurrentHashMap<CORRELATION, ISynchronizer<RESULT>>(0); + private ConcurrentMap<CORRELATION, ISynchronizer<RESULT>> map = new ConcurrentHashMap<>(0); /** * @since 3.0 @@ -100,7 +100,7 @@ public class SynchronizingCorrelator<CORRELATION, RESULT> implements ICorrelator // TODO Make top level class return new ISynchronizer<RESULT>() { - private ISynchronizer<RESULT> delegate = new ResultSynchronizer<RESULT>(); + private ISynchronizer<RESULT> delegate = new ResultSynchronizer<>(); @Override public RESULT get(long timeout) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ThreadPool.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ThreadPool.java index 9b2d712a72..de365ec0de 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ThreadPool.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ThreadPool.java @@ -495,7 +495,7 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH //$FALL-THROUGH$ } - return new LinkedBlockingQueue<Runnable>(); + return new LinkedBlockingQueue<>(); } } @@ -506,7 +506,7 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH { public static final DeadlockDetector INSTANCE = new DeadlockDetector(); - private volatile ArrayList<ThreadPool> pools = new ArrayList<ThreadPool>(); + private volatile ArrayList<ThreadPool> pools = new ArrayList<>(); private DeadlockDetector() { @@ -516,14 +516,14 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH public void register(ThreadPool pool) { - ArrayList<ThreadPool> newList = new ArrayList<ThreadPool>(pools); + ArrayList<ThreadPool> newList = new ArrayList<>(pools); newList.add(pool); pools = newList; } private void unregister(ThreadPool pool) { - ArrayList<ThreadPool> newList = new ArrayList<ThreadPool>(pools); + ArrayList<ThreadPool> newList = new ArrayList<>(pools); newList.remove(pool); pools = newList; } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/TrackableTimerTask.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/TrackableTimerTask.java index d81809a9b3..1b638bfae1 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/TrackableTimerTask.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/TrackableTimerTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2013, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,7 +32,8 @@ public abstract class TrackableTimerTask extends TimerTask public static final boolean TRACK_TIMER_TASKS = OMPlatform.INSTANCE.isProperty("org.eclipse.net4j.util.concurrent.TrackTimerTasks"); private static final Map<TrackableTimerTask, ConstructionInfo> CONSTRUCTION_INFOS = TRACK_TIMER_TASKS - ? new WeakHashMap<TrackableTimerTask, ConstructionInfo>() : null; + ? new WeakHashMap<>() + : null; protected TrackableTimerTask() { @@ -67,7 +68,7 @@ public abstract class TrackableTimerTask extends TimerTask } long maxTimeStamp = System.currentTimeMillis() - minLifeTimeMillis; - Collection<Exception> result = new ArrayList<Exception>(); + Collection<Exception> result = new ArrayList<>(); synchronized (CONSTRUCTION_INFOS) { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/Container.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/Container.java index b61d6680a2..066960ddaf 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/Container.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/Container.java @@ -83,7 +83,7 @@ public abstract class Container<E> extends ShareableLifecycle implements IContai */ public void fireContainerEvent(E[] elements, Kind kind) { - ContainerEvent<E> event = new ContainerEvent<E>(this); + ContainerEvent<E> event = new ContainerEvent<>(this); for (E element : elements) { event.addDelta(element, kind); @@ -110,16 +110,16 @@ public abstract class Container<E> extends ShareableLifecycle implements IContai public void fireContainerEvent(List<IContainerDelta<E>> deltas) { - fireEvent(new ContainerEvent<E>(this, deltas)); + fireEvent(new ContainerEvent<>(this, deltas)); } protected SingleDeltaContainerEvent<E> newContainerEvent(E element, IContainerDelta.Kind kind) { - return new SingleDeltaContainerEvent<E>(this, element, kind); + return new SingleDeltaContainerEvent<>(this, element, kind); } protected ContainerEvent<E> newContainerEvent() { - return new ContainerEvent<E>(this); + return new ContainerEvent<>(this); } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEvent.java index 5eb617a98f..b75b5be5af 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEvent.java @@ -31,7 +31,7 @@ public class ContainerEvent<E> extends Event implements IContainerEvent<E> public ContainerEvent(IContainer<E> container) { super(container); - deltas = new ArrayList<IContainerDelta<E>>(); + deltas = new ArrayList<>(); } public ContainerEvent(IContainer<E> container, List<IContainerDelta<E>> deltas) @@ -88,7 +88,7 @@ public class ContainerEvent<E> extends Event implements IContainerEvent<E> public void addDelta(E element, IContainerDelta.Kind kind) { - addDelta(new ContainerDelta<E>(element, kind)); + addDelta(new ContainerDelta<>(element, kind)); } public void addDelta(IContainerDelta<E> delta) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/LifecycleEventConverter.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/LifecycleEventConverter.java index 5c9aadc50e..ab5ac7df59 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/LifecycleEventConverter.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/LifecycleEventConverter.java @@ -81,8 +81,8 @@ public class LifecycleEventConverter<E> implements IListener protected IContainerEvent<E> createContainerEvent(IContainer<E> container, E element, IContainerDelta.Kind kind) { - ContainerEvent<E> event = new ContainerEvent<E>(container); - event.addDelta(new ContainerDelta<E>(element, kind)); + ContainerEvent<E> event = new ContainerEvent<>(container); + event.addDelta(new ContainerDelta<>(element, kind)); return event; } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ManagedContainer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ManagedContainer.java index 60ec7c5c96..2dc7b542d0 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ManagedContainer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ManagedContainer.java @@ -58,7 +58,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer private List<IElementProcessor> postProcessors; - private IRegistry<ElementKey, Object> elementRegistry = new HashMapRegistry<ElementKey, Object>(); + private IRegistry<ElementKey, Object> elementRegistry = new HashMapRegistry<>(); @ExcludeFromDump private transient long maxElementID; @@ -163,7 +163,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer { if (processExistingElements) { - ContainerEvent<Object> event = new ContainerEvent<Object>(this); + ContainerEvent<Object> event = new ContainerEvent<>(this); for (Entry<ElementKey, Object> entry : getElementRegistryEntries()) { ElementKey key = entry.getKey(); @@ -207,7 +207,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer public Set<String> getProductGroups() { checkActive(); - Set<String> result = new HashSet<String>(); + Set<String> result = new HashSet<>(); for (IFactoryKey key : factoryRegistry.keySet()) { result.add(key.getProductGroup()); @@ -225,7 +225,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer public Set<String> getFactoryTypes(String productGroup) { checkActive(); - Set<String> result = new HashSet<String>(); + Set<String> result = new HashSet<>(); for (IFactoryKey key : factoryRegistry.keySet()) { if (ObjectUtil.equals(key.getProductGroup(), productGroup)) @@ -296,7 +296,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer public Object[] getElements(String productGroup) { checkActive(); - List<Object> result = new ArrayList<Object>(); + List<Object> result = new ArrayList<>(); for (Entry<ElementKey, Object> entry : getElementRegistryEntries()) { ElementKey key = entry.getKey(); @@ -313,7 +313,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer public Object[] getElements(String productGroup, String factoryType) { checkActive(); - List<Object> result = new ArrayList<Object>(); + List<Object> result = new ArrayList<>(); for (Entry<ElementKey, Object> entry : getElementRegistryEntries()) { ElementKey key = entry.getKey(); @@ -400,7 +400,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer protected Object putElement(ElementKey key, Object element) { - ContainerEvent<Object> event = new ContainerEvent<Object>(this); + ContainerEvent<Object> event = new ContainerEvent<>(this); Object oldElement; synchronized (elementRegistry) { @@ -449,7 +449,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer if (element != null) { EventUtil.removeListener(element, elementListener); - fireEvent(new SingleDeltaContainerEvent<Object>(this, element, IContainerDelta.Kind.REMOVED)); + fireEvent(new SingleDeltaContainerEvent<>(this, element, IContainerDelta.Kind.REMOVED)); if (element instanceof ContainerAware) { @@ -469,7 +469,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer { if (!elementRegistry.isEmpty()) { - event = new ContainerEvent<Object>(this); + event = new ContainerEvent<>(this); for (Object element : elementRegistry.values()) { EventUtil.removeListener(element, elementListener); @@ -525,7 +525,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer synchronized (elementRegistry) { ObjectOutputStream oos = new ObjectOutputStream(stream); - List<Entry<ElementKey, Object>> entries = new ArrayList<Entry<ElementKey, Object>>(elementRegistry.entrySet()); + List<Entry<ElementKey, Object>> entries = new ArrayList<>(elementRegistry.entrySet()); Collections.sort(entries, new EntryComparator()); oos.writeInt(entries.size()); @@ -574,12 +574,12 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer protected IRegistry<IFactoryKey, IFactory> createFactoryRegistry() { - return new HashMapRegistry<IFactoryKey, IFactory>(); + return new HashMapRegistry<>(); } protected List<IElementProcessor> createPostProcessors() { - return new ArrayList<IElementProcessor>(); + return new ArrayList<>(); } /** diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SetContainer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SetContainer.java index cbb9e39fa2..1697370f89 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SetContainer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SetContainer.java @@ -136,7 +136,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab @Override public boolean addAllElements(Collection<E> elements) { - List<E> validElements = new ArrayList<E>(); + List<E> validElements = new ArrayList<>(); for (E element : elements) { if (validateElement(element)) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SingleDeltaContainerEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SingleDeltaContainerEvent.java index 467002723a..a23cd055fd 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SingleDeltaContainerEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SingleDeltaContainerEvent.java @@ -31,7 +31,7 @@ public class SingleDeltaContainerEvent<E> extends Event implements IContainerEve public SingleDeltaContainerEvent(IContainer<E> container, E element, IContainerDelta.Kind kind) { super(container); - deltas = new IContainerDelta[] { new ContainerDelta<E>(element, kind) }; + deltas = new IContainerDelta[] { new ContainerDelta<>(element, kind) }; } /** diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/AbstractDelegator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/AbstractDelegator.java index f95ecd0b52..64b0fc5c4b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/AbstractDelegator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/AbstractDelegator.java @@ -37,7 +37,7 @@ public abstract class AbstractDelegator<E> extends Notifier implements IContaine IListener[] listeners = getListeners(); if (listeners != null) { - fireEvent(new SingleDeltaContainerEvent<E>(this, o, IContainerDelta.Kind.ADDED), listeners); + fireEvent(new SingleDeltaContainerEvent<>(this, o, IContainerDelta.Kind.ADDED), listeners); } } @@ -47,14 +47,14 @@ public abstract class AbstractDelegator<E> extends Notifier implements IContaine IListener[] listeners = getListeners(); if (listeners != null) { - fireEvent(new SingleDeltaContainerEvent<E>(this, (E)o, IContainerDelta.Kind.REMOVED), listeners); + fireEvent(new SingleDeltaContainerEvent<>(this, (E)o, IContainerDelta.Kind.REMOVED), listeners); } } @SuppressWarnings("unchecked") protected ContainerEvent<E> createEvent(Collection<? super E> c, Kind kind) { - ContainerEvent<E> event = new ContainerEvent<E>(this); + ContainerEvent<E> event = new ContainerEvent<>(this); for (Object o : c) { event.addDelta((E)o, kind); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerCollection.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerCollection.java index dd6044218f..8433c97a2c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerCollection.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerCollection.java @@ -65,7 +65,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon @Override public boolean addAll(Collection<? extends E> c) { - ContainerEvent<E> event = new ContainerEvent<E>(this); + ContainerEvent<E> event = new ContainerEvent<>(this); for (E e : c) { boolean modified = getDelegate().add(e); @@ -118,7 +118,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon @SuppressWarnings("unchecked") public boolean removeAll(Collection<?> c) { - ContainerEvent<E> event = new ContainerEvent<E>(this); + ContainerEvent<E> event = new ContainerEvent<>(this); for (Object o : c) { boolean modified = getDelegate().remove(o); @@ -138,7 +138,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon @SuppressWarnings("unchecked") public boolean retainAll(Collection<?> c) { - ContainerEvent<E> event = new ContainerEvent<E>(this); + ContainerEvent<E> event = new ContainerEvent<>(this); for (Object o : getDelegate()) { if (!c.contains(o)) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerList.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerList.java index cabe726a93..23bc229585 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerList.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerList.java @@ -124,7 +124,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain public E set(int index, E element) { E removed = getDelegate().set(index, element); - ContainerEvent<E> event = new ContainerEvent<E>(ContainerList.this); + ContainerEvent<E> event = new ContainerEvent<>(ContainerList.this); event.addDelta(removed, IContainerDelta.Kind.REMOVED); event.addDelta(element, IContainerDelta.Kind.ADDED); IListener[] listeners = getListeners(); @@ -181,7 +181,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain public void set(E o) { getDelegate().set(o); - ContainerEvent<E> event = new ContainerEvent<E>(ContainerList.this); + ContainerEvent<E> event = new ContainerEvent<>(ContainerList.this); event.addDelta(last, IContainerDelta.Kind.REMOVED); event.addDelta(o, IContainerDelta.Kind.ADDED); IListener[] listeners = getListeners(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerMap.java index 22929de4eb..daad22708e 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerMap.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerMap.java @@ -64,14 +64,14 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple @Override public V put(K key, V value) { - ContainerEvent<Map.Entry<K, V>> event = new ContainerEvent<Map.Entry<K, V>>(this); + ContainerEvent<Map.Entry<K, V>> event = new ContainerEvent<>(this); V removed = getDelegate().put(key, value); if (removed != null) { - event.addDelta(new ContainerMapEntry<K, V>(key, removed), IContainerDelta.Kind.REMOVED); + event.addDelta(new ContainerMapEntry<>(key, removed), IContainerDelta.Kind.REMOVED); } - event.addDelta(new ContainerMapEntry<K, V>(key, value), IContainerDelta.Kind.ADDED); + event.addDelta(new ContainerMapEntry<>(key, value), IContainerDelta.Kind.ADDED); IListener[] listeners = getListeners(); if (listeners != null) { @@ -87,7 +87,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple @Override public void putAll(Map<? extends K, ? extends V> t) { - ContainerEvent<Map.Entry<K, V>> event = new ContainerEvent<Map.Entry<K, V>>(this); + ContainerEvent<Map.Entry<K, V>> event = new ContainerEvent<>(this); Iterator<? extends Entry<? extends K, ? extends V>> i = t.entrySet().iterator(); while (i.hasNext()) { @@ -97,10 +97,10 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple V removed = getDelegate().put(key, value); if (removed != null) { - event.addDelta(new ContainerMapEntry<K, V>(key, removed), IContainerDelta.Kind.REMOVED); + event.addDelta(new ContainerMapEntry<>(key, removed), IContainerDelta.Kind.REMOVED); } - event.addDelta(new ContainerMapEntry<K, V>(key, value), IContainerDelta.Kind.ADDED); + event.addDelta(new ContainerMapEntry<>(key, value), IContainerDelta.Kind.ADDED); } dispatchEvent(event); @@ -115,7 +115,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple V removed = getDelegate().remove(key); if (removed != null) { - fireRemovedEvent(new ContainerMapEntry<Object, V>(key, removed)); + fireRemovedEvent(new ContainerMapEntry<>(key, removed)); } return removed; @@ -182,7 +182,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple @Override public Set<Map.Entry<K, V>> entrySet() { - return new ContainerSet<Map.Entry<K, V>>(getDelegate().entrySet()); + return new ContainerSet<>(getDelegate().entrySet()); } /** @@ -191,7 +191,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple @Override public Set<K> keySet() { - return new ContainerSet<K>(getDelegate().keySet()); + return new ContainerSet<>(getDelegate().keySet()); } /** @@ -200,7 +200,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple @Override public Collection<V> values() { - return new ContainerCollection<V>(getDelegate().values()); + return new ContainerCollection<>(getDelegate().values()); } /** diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ValueNotifier.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ValueNotifier.java index 0676c1ec9c..541062bdc4 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ValueNotifier.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ValueNotifier.java @@ -66,7 +66,7 @@ public class ValueNotifier<VALUE> extends Notifier if (!ObjectUtil.equals(value, oldValue)) { this.value = value; - fireEvent(new ValueEvent<VALUE>(this, oldValue, value)); + fireEvent(new ValueEvent<>(this, oldValue, value)); } } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/PropertiesFactory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/PropertiesFactory.java index 8c0852c84a..9a3c8a7064 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/PropertiesFactory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/PropertiesFactory.java @@ -38,7 +38,7 @@ public abstract class PropertiesFactory extends Factory @Override public Object create(String description) throws ProductCreationException { - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); if (!StringUtil.isEmpty(description)) { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/CachedFileMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/CachedFileMap.java index 419d7bcd1d..f2ee8cb331 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/CachedFileMap.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/CachedFileMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,7 +19,7 @@ import java.util.Map; */ public abstract class CachedFileMap<K extends Comparable<K>, V> extends SortedFileMap<K, V> { - private Map<K, V> cache = new HashMap<K, V>(); + private Map<K, V> cache = new HashMap<>(); public CachedFileMap(File file, String mode) { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java index 48e98e6d4e..9bb821777f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java @@ -1043,7 +1043,7 @@ public final class IOUtil */ public static List<File> glob(String pattern, File folder) { - List<File> result = new ArrayList<File>(); + List<File> result = new ArrayList<>(); pattern = normalizeSeparator(pattern); if (pattern.endsWith(File.separator)) { @@ -1110,7 +1110,7 @@ public final class IOUtil */ public static class FileCollector implements IOVisitor { - private List<File> files = new ArrayList<File>(); + private List<File> files = new ArrayList<>(); public FileCollector() { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringCompressor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringCompressor.java index 515758932b..ff1b7003bc 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringCompressor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringCompressor.java @@ -53,9 +53,9 @@ public class StringCompressor implements StringIO private int lastID; - private Map<String, ID> stringToID = new HashMap<String, ID>(); + private Map<String, ID> stringToID = new HashMap<>(); - private Map<Integer, String> idToString = new HashMap<Integer, String>(); + private Map<Integer, String> idToString = new HashMap<>(); private Collection<Integer> pendingAcknowledgements = createAcknowledgementCollection(); @@ -437,7 +437,7 @@ public class StringCompressor implements StringIO private static Collection<Integer> createAcknowledgementCollection() { - return new HashSet<Integer>(); + return new HashSet<>(); } /** diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XMLOutput.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XMLOutput.java index c33c4f980d..8fceda09ef 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XMLOutput.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XMLOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -42,7 +42,7 @@ public class XMLOutput private char[] indentation; - private LinkedList<Element> stack = new LinkedList<Element>(); + private LinkedList<Element> stack = new LinkedList<>(); private Element element; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java index fa71a4fe30..6250dd5f91 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java @@ -464,7 +464,7 @@ public final class LifecycleUtil return pojo; } - Delegator<T> h = new Delegator<T>(pojo, delegate); + Delegator<T> h = new Delegator<>(pojo, delegate); final Class<?>[] interfaces = { pojoInterface, INTERFACE }; @SuppressWarnings("unchecked") diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/RollingLog.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/RollingLog.java index c151fce457..6a853f986f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/RollingLog.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/RollingLog.java @@ -60,7 +60,7 @@ public class RollingLog extends Worker implements Log, Iterable<LogLine> private boolean writeBulk = true; - private List<LogLine> queue = new ArrayList<LogLine>(); + private List<LogLine> queue = new ArrayList<>(); public RollingLog(String logFile, long logSize, boolean append) { @@ -164,11 +164,11 @@ public class RollingLog extends Worker implements Log, Iterable<LogLine> if (writeBulk) { logLines = queue; - queue = new ArrayList<LogLine>(); + queue = new ArrayList<>(); } else { - logLines = new ArrayList<LogLine>(); + logLines = new ArrayList<>(); logLines.add(queue.remove(0)); } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProbingSubMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProbingSubMonitor.java index 993984cadd..8b57166dbf 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProbingSubMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProbingSubMonitor.java @@ -97,11 +97,11 @@ public final class ProbingSubMonitor extends org.eclipse.net4j.util.om.monitor.S { private static final boolean TRACE = Boolean.getBoolean("submonitor.probing.trace"); - private static final Map<StackTraceElement, Statistics> STATISTICS = new HashMap<StackTraceElement, Statistics>(); + private static final Map<StackTraceElement, Statistics> STATISTICS = new HashMap<>(); - private static final Map<Integer, KeyedWeakReference> MAP = new ConcurrentHashMap<Integer, KeyedWeakReference>(); + private static final Map<Integer, KeyedWeakReference> MAP = new ConcurrentHashMap<>(); - private static final ReferenceQueue<ProbingSubMonitor> QUEUE = new ReferenceQueue<ProbingSubMonitor>(); + private static final ReferenceQueue<ProbingSubMonitor> QUEUE = new ReferenceQueue<>(); private static final AtomicInteger COUNTER = new AtomicInteger(); @@ -121,7 +121,7 @@ public final class ProbingSubMonitor extends org.eclipse.net4j.util.om.monitor.S private final int key; - private final Map<StackTraceElement, Probe> probes = new HashMap<StackTraceElement, Probe>(); + private final Map<StackTraceElement, Probe> probes = new HashMap<>(); private StackTraceElement location = determineLocation(); @@ -524,11 +524,11 @@ public final class ProbingSubMonitor extends org.eclipse.net4j.util.om.monitor.S List<Row> newRows; if (rows == null) { - newRows = new ArrayList<Row>(10); + newRows = new ArrayList<>(10); } else { - newRows = new ArrayList<Row>(10 + rows.length); + newRows = new ArrayList<>(10 + rows.length); for (int i = 0; i < rows.length; i++) { Row row = rows[i]; @@ -655,7 +655,7 @@ public final class ProbingSubMonitor extends org.eclipse.net4j.util.om.monitor.S { if (forkTargets.length != 1 || probe.forkTargets.length != 1 || !forkTargets[0].equals(probe.forkTargets[0])) { - Set<StackTraceElement> set = new HashSet<StackTraceElement>(); + Set<StackTraceElement> set = new HashSet<>(); set.addAll(Arrays.asList(forkTargets)); set.addAll(Arrays.asList(probe.forkTargets)); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/PerfTracer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/PerfTracer.java index e8732e743e..d477295251 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/PerfTracer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/PerfTracer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ public class PerfTracer extends ContextTracer { public static final long NOT_STARTED = 0L; - private Map<Object, Long> timers = new IdentityHashMap<Object, Long>(); + private Map<Object, Long> timers = new IdentityHashMap<>(); public PerfTracer(OMTracer delegate, Class<?> context) { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceServer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceServer.java index 024f66a81c..bb91b24fd5 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceServer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceServer.java @@ -47,7 +47,7 @@ public class RemoteTraceServer private ServerSocket serverSocket; - private Queue<Listener> listeners = new ConcurrentLinkedQueue<Listener>(); + private Queue<Listener> listeners = new ConcurrentLinkedQueue<>(); public RemoteTraceServer() throws IOException { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java index 8c0d3a81cb..04444d3ffc 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java @@ -23,7 +23,7 @@ import java.util.List; */ public class Properties<RECEIVER> implements IProperties<RECEIVER> { - private final List<Property<RECEIVER>> properties = new ArrayList<Property<RECEIVER>>(); + private final List<Property<RECEIVER>> properties = new ArrayList<>(); private final Class<RECEIVER> receiverType; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/Interner.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/Interner.java index cf7e1b7841..e6eb70f2e4 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/Interner.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/Interner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2013, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,7 +28,7 @@ public class Interner<E> private Entry<E>[] entries; - private ReferenceQueue<E> queue = new ReferenceQueue<E>(); + private ReferenceQueue<E> queue = new ReferenceQueue<>(); public Interner() { @@ -127,7 +127,7 @@ public class Interner<E> protected Entry<E> createEntry(E object, int hashCode) { - return new Entry<E>(object, hashCode, queue); + return new Entry<>(object, hashCode, queue); } /** diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceMonitor.java index 5c62a27080..aec27ed89f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,7 +27,7 @@ public abstract class ReferenceMonitor<T> extends ReferenceQueueWorker<T> public void monitor(T object) { ReferenceQueue<T> queue = getQueue(); - new WeakReference<T>(object, queue); + new WeakReference<>(object, queue); } @Override diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceQueueWorker.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceQueueWorker.java index ac6b944843..e0648c6ea0 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceQueueWorker.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceQueueWorker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010-2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2010-2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -37,7 +37,7 @@ public abstract class ReferenceQueueWorker<T> extends Worker */ public static final int DEFAULT_POLL_MILLIS = 1000 * 60; // One minute - private ReferenceQueue<T> queue = new ReferenceQueue<T>(); + private ReferenceQueue<T> queue = new ReferenceQueue<>(); private long pollMillis; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java index 6baffc0cf2..26c489b55d 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java @@ -108,7 +108,7 @@ public abstract class ReferenceValueMap<K, V> extends ReferenceValueMap2<K, V> i @Override protected KeyedReference<K, V> createReference(K key, V value, ReferenceQueue<V> queue) { - return new KeyedStrongReference<K, V>(key, value); + return new KeyedStrongReference<>(key, value); } @Override @@ -135,7 +135,7 @@ public abstract class ReferenceValueMap<K, V> extends ReferenceValueMap2<K, V> i @Override protected KeyedReference<K, V> createReference(K key, V value, ReferenceQueue<V> queue) { - return new KeyedSoftReference<K, V>(key, value, queue); + return new KeyedSoftReference<>(key, value, queue); } } @@ -156,7 +156,7 @@ public abstract class ReferenceValueMap<K, V> extends ReferenceValueMap2<K, V> i @Override protected KeyedReference<K, V> createReference(K key, V value, ReferenceQueue<V> queue) { - return new KeyedWeakReference<K, V>(key, value, queue); + return new KeyedWeakReference<>(key, value, queue); } } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap2.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap2.java index ca350dde8b..4f6dd39713 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap2.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap2.java @@ -166,7 +166,7 @@ public abstract class ReferenceValueMap2<K, V> extends AbstractMap<K, V> protected ReferenceQueue<V> createQueue() { - return new ReferenceQueue<V>(); + return new ReferenceQueue<>(); } /** @@ -232,7 +232,7 @@ public abstract class ReferenceValueMap2<K, V> extends AbstractMap<K, V> @Override protected KeyedReference<K, V> createReference(K key, V value, ReferenceQueue<V> queue) { - return new KeyedStrongReference<K, V>(key, value); + return new KeyedStrongReference<>(key, value); } @Override @@ -259,7 +259,7 @@ public abstract class ReferenceValueMap2<K, V> extends AbstractMap<K, V> @Override protected KeyedReference<K, V> createReference(K key, V value, ReferenceQueue<V> queue) { - return new KeyedSoftReference<K, V>(key, value, queue); + return new KeyedSoftReference<>(key, value, queue); } } @@ -280,7 +280,7 @@ public abstract class ReferenceValueMap2<K, V> extends AbstractMap<K, V> @Override protected KeyedReference<K, V> createReference(K key, V value, ReferenceQueue<V> queue) { - return new KeyedWeakReference<K, V>(key, value, queue); + return new KeyedWeakReference<>(key, value, queue); } } @@ -426,7 +426,7 @@ public abstract class ReferenceValueMap2<K, V> extends AbstractMap<K, V> V value = dereference(entry.getValue()); if (value != null) { - nextEntry = new MapEntry<K, V>(lastKey, value); + nextEntry = new MapEntry<>(lastKey, value); return true; } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/DelegatingRegistry.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/DelegatingRegistry.java index 9f1b6e3d03..47a67e3bff 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/DelegatingRegistry.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/DelegatingRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -114,7 +114,7 @@ public abstract class DelegatingRegistry<K, V> extends Registry<K, V> protected Set<Entry<K, V>> mergedEntrySet() { - final Map<K, V> merged = new HashMap<K, V>(); + final Map<K, V> merged = new HashMap<>(); if (delegate != null) { merged.putAll(delegate); @@ -126,7 +126,7 @@ public abstract class DelegatingRegistry<K, V> extends Registry<K, V> protected Set<K> mergedKeySet() { - final Set<K> merged = new HashSet<K>(); + final Set<K> merged = new HashSet<>(); if (delegate != null) { merged.addAll(delegate.keySet()); @@ -138,7 +138,7 @@ public abstract class DelegatingRegistry<K, V> extends Registry<K, V> protected Collection<V> mergedValues() { - final List<V> result = new ArrayList<V>(); + final List<V> result = new ArrayList<>(); for (K key : keySet()) { result.add(get(key)); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/HashMapDelegatingRegistry.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/HashMapDelegatingRegistry.java index ec8ded91fb..cc68346b7d 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/HashMapDelegatingRegistry.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/HashMapDelegatingRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,25 +23,25 @@ public class HashMapDelegatingRegistry<K, V> extends DelegatingRegistry<K, V> public HashMapDelegatingRegistry(IRegistry<K, V> delegate) { super(delegate); - map = new HashMap<K, V>(); + map = new HashMap<>(); } public HashMapDelegatingRegistry(IRegistry<K, V> delegate, int initialCapacity) { super(delegate); - map = new HashMap<K, V>(initialCapacity); + map = new HashMap<>(initialCapacity); } public HashMapDelegatingRegistry(IRegistry<K, V> delegate, int initialCapacity, float loadFactor) { super(delegate); - map = new HashMap<K, V>(initialCapacity, loadFactor); + map = new HashMap<>(initialCapacity, loadFactor); } public HashMapDelegatingRegistry(IRegistry<K, V> delegate, Map<? extends K, ? extends V> m) { super(delegate); - map = new HashMap<K, V>(m); + map = new HashMap<>(m); } @Override diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/HashMapRegistry.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/HashMapRegistry.java index a04b19929a..037418a61b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/HashMapRegistry.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/HashMapRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,22 +22,22 @@ public class HashMapRegistry<K, V> extends Registry<K, V> public HashMapRegistry() { - map = new HashMap<K, V>(); + map = new HashMap<>(); } public HashMapRegistry(int initialCapacity) { - map = new HashMap<K, V>(initialCapacity); + map = new HashMap<>(initialCapacity); } public HashMapRegistry(int initialCapacity, float loadFactor) { - map = new HashMap<K, V>(initialCapacity, loadFactor); + map = new HashMap<>(initialCapacity, loadFactor); } public HashMapRegistry(Map<? extends K, ? extends V> m) { - map = new HashMap<K, V>(m); + map = new HashMap<>(m); } @Override diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/Registry.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/Registry.java index d396a4a1ed..28e3d6cd0a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/Registry.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/Registry.java @@ -302,12 +302,12 @@ public abstract class Registry<K, V> extends Container<Map.Entry<K, V>> implemen public void rememberRegistered(K key, V value) { - event.addDelta(new Element<K, V>(key, value), IContainerDelta.Kind.ADDED); + event.addDelta(new Element<>(key, value), IContainerDelta.Kind.ADDED); } public void rememberDeregistered(K key, V value) { - event.addDelta(new Element<K, V>(key, value), IContainerDelta.Kind.REMOVED); + event.addDelta(new Element<>(key, value), IContainerDelta.Kind.REMOVED); } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/RegistryUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/RegistryUtil.java index 7e65703acc..2f94eadea7 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/RegistryUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/RegistryUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,6 +26,6 @@ public final class RegistryUtil return registry; } - return new UnmodifiableRegistry<K, V>(registry); + return new UnmodifiableRegistry<>(registry); } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManager.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManager.java index fb06249ce3..35c616c3eb 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManager.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManager.java @@ -24,7 +24,7 @@ import java.util.Map; public class UserManager extends Lifecycle implements IUserManager, IAuthenticator { @ExcludeFromDump - protected transient Map<String, char[]> users = new HashMap<String, char[]>(); + protected transient Map<String, char[]> users = new HashMap<>(); public UserManager() { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/Transaction.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/Transaction.java index 2d50dc66f2..267b08d768 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/Transaction.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/Transaction.java @@ -18,7 +18,7 @@ import java.util.List; */ public class Transaction<CONTEXT> implements ITransaction<CONTEXT> { - private List<ITransactionalOperation<CONTEXT>> operations = new ArrayList<ITransactionalOperation<CONTEXT>>(); + private List<ITransactionalOperation<CONTEXT>> operations = new ArrayList<>(); private CONTEXT context; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/TransactionUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/TransactionUtil.java index ae0b679fcf..e650af43e8 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/TransactionUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/TransactionUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,6 +21,6 @@ public final class TransactionUtil public static <CONTEXT> ITransaction<CONTEXT> createTransaction(CONTEXT context) { - return new Transaction<CONTEXT>(context); + return new Transaction<>(context); } } |