6880112: Project Coin: Port JDK core library code to use diamond operator
Reviewed-by: darcy, lancea, alanb, briangoetz, mduigou, mchung
This commit is contained in:
parent
cf7aa136ac
commit
6e7cb44eea
@ -1704,7 +1704,7 @@ class BandStructure {
|
||||
for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
|
||||
assert(attrIndexLimit[i] == 0);
|
||||
attrIndexLimit[i] = 32; // just for the sake of predefs.
|
||||
attrDefs.set(i, new ArrayList<Attribute.Layout>(Collections.nCopies(
|
||||
attrDefs.set(i, new ArrayList<>(Collections.nCopies(
|
||||
attrIndexLimit[i], (Attribute.Layout)null)));
|
||||
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ class ConstantPool {
|
||||
void completeReferencesIn(Set<Entry> cpRefs, boolean flattenSigs) {
|
||||
cpRefs.remove(null);
|
||||
for (ListIterator<Entry> work =
|
||||
new ArrayList<Entry>(cpRefs).listIterator(cpRefs.size());
|
||||
new ArrayList<>(cpRefs).listIterator(cpRefs.size());
|
||||
work.hasPrevious(); ) {
|
||||
Entry e = work.previous();
|
||||
work.remove(); // pop stack
|
||||
|
@ -322,7 +322,7 @@ class Package {
|
||||
}
|
||||
|
||||
public void setInnerClasses(Collection<InnerClass> ics) {
|
||||
innerClasses = (ics == null) ? null : new ArrayList<InnerClass>(ics);
|
||||
innerClasses = (ics == null) ? null : new ArrayList<>(ics);
|
||||
// Edit the attribute list, if necessary.
|
||||
Attribute a = getAttribute(attrInnerClassesEmpty);
|
||||
if (innerClasses != null && a == null)
|
||||
|
@ -34,7 +34,7 @@ import java.io.File;
|
||||
*/
|
||||
|
||||
class DeleteOnExitHook {
|
||||
private static LinkedHashSet<String> files = new LinkedHashSet<String>();
|
||||
private static LinkedHashSet<String> files = new LinkedHashSet<>();
|
||||
static {
|
||||
// DeleteOnExitHook must be the last shutdown hook to be invoked.
|
||||
// Application shutdown hooks may add the first file to the
|
||||
@ -71,7 +71,7 @@ class DeleteOnExitHook {
|
||||
files = null;
|
||||
}
|
||||
|
||||
ArrayList<String> toBeDeleted = new ArrayList<String>(theFiles);
|
||||
ArrayList<String> toBeDeleted = new ArrayList<>(theFiles);
|
||||
|
||||
// reverse the list to maintain previous jdk deletion order.
|
||||
// Last in first deleted.
|
||||
|
@ -1067,7 +1067,7 @@ public class File
|
||||
if ((names == null) || (filter == null)) {
|
||||
return names;
|
||||
}
|
||||
List<String> v = new ArrayList<String>();
|
||||
List<String> v = new ArrayList<>();
|
||||
for (int i = 0 ; i < names.length ; i++) {
|
||||
if (filter.accept(this, names[i])) {
|
||||
v.add(names[i]);
|
||||
@ -1158,7 +1158,7 @@ public class File
|
||||
public File[] listFiles(FilenameFilter filter) {
|
||||
String ss[] = list();
|
||||
if (ss == null) return null;
|
||||
ArrayList<File> files = new ArrayList<File>();
|
||||
ArrayList<File> files = new ArrayList<>();
|
||||
for (String s : ss)
|
||||
if ((filter == null) || filter.accept(this, s))
|
||||
files.add(new File(s, this));
|
||||
@ -1195,7 +1195,7 @@ public class File
|
||||
public File[] listFiles(FileFilter filter) {
|
||||
String ss[] = list();
|
||||
if (ss == null) return null;
|
||||
ArrayList<File> files = new ArrayList<File>();
|
||||
ArrayList<File> files = new ArrayList<>();
|
||||
for (String s : ss) {
|
||||
File f = new File(s, this);
|
||||
if ((filter == null) || filter.accept(f))
|
||||
|
@ -56,7 +56,7 @@ class FileInputStream extends InputStream
|
||||
private volatile boolean closed = false;
|
||||
|
||||
private static final ThreadLocal<Boolean> runningFinalize =
|
||||
new ThreadLocal<Boolean>();
|
||||
new ThreadLocal<>();
|
||||
|
||||
private static boolean isRunningFinalize() {
|
||||
Boolean val;
|
||||
|
@ -69,7 +69,7 @@ class FileOutputStream extends OutputStream
|
||||
private final Object closeLock = new Object();
|
||||
private volatile boolean closed = false;
|
||||
private static final ThreadLocal<Boolean> runningFinalize =
|
||||
new ThreadLocal<Boolean>();
|
||||
new ThreadLocal<>();
|
||||
|
||||
private static boolean isRunningFinalize() {
|
||||
Boolean val;
|
||||
|
@ -725,7 +725,7 @@ implements Serializable {
|
||||
*/
|
||||
|
||||
public FilePermissionCollection() {
|
||||
perms = new ArrayList<Permission>();
|
||||
perms = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -830,7 +830,7 @@ implements Serializable {
|
||||
// Don't call out.defaultWriteObject()
|
||||
|
||||
// Write out Vector
|
||||
Vector<Permission> permissions = new Vector<Permission>(perms.size());
|
||||
Vector<Permission> permissions = new Vector<>(perms.size());
|
||||
synchronized (this) {
|
||||
permissions.addAll(perms);
|
||||
}
|
||||
@ -853,7 +853,7 @@ implements Serializable {
|
||||
|
||||
// Get the one we want
|
||||
Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
|
||||
perms = new ArrayList<Permission>(permissions.size());
|
||||
perms = new ArrayList<>(permissions.size());
|
||||
perms.addAll(permissions);
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public class ObjectInputStream
|
||||
|
||||
/** table mapping primitive type names to corresponding class objects */
|
||||
private static final HashMap<String, Class<?>> primClasses
|
||||
= new HashMap<String, Class<?>>(8, 1.0F);
|
||||
= new HashMap<>(8, 1.0F);
|
||||
static {
|
||||
primClasses.put("boolean", boolean.class);
|
||||
primClasses.put("byte", byte.class);
|
||||
@ -229,11 +229,11 @@ public class ObjectInputStream
|
||||
private static class Caches {
|
||||
/** cache of subclass security audit results */
|
||||
static final ConcurrentMap<WeakClassKey,Boolean> subclassAudits =
|
||||
new ConcurrentHashMap<WeakClassKey,Boolean>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/** queue for WeakReferences to audited subclasses */
|
||||
static final ReferenceQueue<Class<?>> subclassAuditsQueue =
|
||||
new ReferenceQueue<Class<?>>();
|
||||
new ReferenceQueue<>();
|
||||
}
|
||||
|
||||
/** filter stream for handling block data conversion */
|
||||
|
@ -165,11 +165,11 @@ public class ObjectOutputStream
|
||||
private static class Caches {
|
||||
/** cache of subclass security audit results */
|
||||
static final ConcurrentMap<WeakClassKey,Boolean> subclassAudits =
|
||||
new ConcurrentHashMap<WeakClassKey,Boolean>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/** queue for WeakReferences to audited subclasses */
|
||||
static final ReferenceQueue<Class<?>> subclassAuditsQueue =
|
||||
new ReferenceQueue<Class<?>>();
|
||||
new ReferenceQueue<>();
|
||||
}
|
||||
|
||||
/** filter stream for handling block data conversion */
|
||||
@ -2413,7 +2413,7 @@ public class ObjectOutputStream
|
||||
private final List<String> stack;
|
||||
|
||||
DebugTraceInfoStack() {
|
||||
stack = new ArrayList<String>();
|
||||
stack = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,18 +84,18 @@ public class ObjectStreamClass implements Serializable {
|
||||
private static class Caches {
|
||||
/** cache mapping local classes -> descriptors */
|
||||
static final ConcurrentMap<WeakClassKey,Reference<?>> localDescs =
|
||||
new ConcurrentHashMap<WeakClassKey,Reference<?>>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/** cache mapping field group/local desc pairs -> field reflectors */
|
||||
static final ConcurrentMap<FieldReflectorKey,Reference<?>> reflectors =
|
||||
new ConcurrentHashMap<FieldReflectorKey,Reference<?>>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/** queue for WeakReferences to local classes */
|
||||
private static final ReferenceQueue<Class<?>> localDescsQueue =
|
||||
new ReferenceQueue<Class<?>>();
|
||||
new ReferenceQueue<>();
|
||||
/** queue for WeakReferences to field reflectors keys */
|
||||
private static final ReferenceQueue<Class<?>> reflectorsQueue =
|
||||
new ReferenceQueue<Class<?>>();
|
||||
new ReferenceQueue<>();
|
||||
}
|
||||
|
||||
/** class associated with this descriptor (if any) */
|
||||
@ -290,7 +290,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
EntryFuture future = null;
|
||||
if (entry == null) {
|
||||
EntryFuture newEntry = new EntryFuture();
|
||||
Reference<?> newRef = new SoftReference<EntryFuture>(newEntry);
|
||||
Reference<?> newRef = new SoftReference<>(newEntry);
|
||||
do {
|
||||
if (ref != null) {
|
||||
Caches.localDescs.remove(key, ref);
|
||||
@ -329,7 +329,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
entry = th;
|
||||
}
|
||||
if (future.set(entry)) {
|
||||
Caches.localDescs.put(key, new SoftReference<Object>(entry));
|
||||
Caches.localDescs.put(key, new SoftReference<>(entry));
|
||||
} else {
|
||||
// nested lookup call already set future
|
||||
entry = future.get();
|
||||
@ -1130,7 +1130,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
private ClassDataSlot[] getClassDataLayout0()
|
||||
throws InvalidClassException
|
||||
{
|
||||
ArrayList<ClassDataSlot> slots = new ArrayList<ClassDataSlot>();
|
||||
ArrayList<ClassDataSlot> slots = new ArrayList<>();
|
||||
Class<?> start = cl, end = cl;
|
||||
|
||||
// locate closest non-serializable superclass
|
||||
@ -1566,7 +1566,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
|
||||
ObjectStreamField[] boundFields =
|
||||
new ObjectStreamField[serialPersistentFields.length];
|
||||
Set<String> fieldNames = new HashSet<String>(serialPersistentFields.length);
|
||||
Set<String> fieldNames = new HashSet<>(serialPersistentFields.length);
|
||||
|
||||
for (int i = 0; i < serialPersistentFields.length; i++) {
|
||||
ObjectStreamField spf = serialPersistentFields[i];
|
||||
@ -1604,7 +1604,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
*/
|
||||
private static ObjectStreamField[] getDefaultSerialFields(Class<?> cl) {
|
||||
Field[] clFields = cl.getDeclaredFields();
|
||||
ArrayList<ObjectStreamField> list = new ArrayList<ObjectStreamField>();
|
||||
ArrayList<ObjectStreamField> list = new ArrayList<>();
|
||||
int mask = Modifier.STATIC | Modifier.TRANSIENT;
|
||||
|
||||
for (int i = 0; i < clFields.length; i++) {
|
||||
@ -1855,8 +1855,8 @@ public class ObjectStreamClass implements Serializable {
|
||||
writeKeys = new long[nfields];
|
||||
offsets = new int[nfields];
|
||||
typeCodes = new char[nfields];
|
||||
ArrayList<Class<?>> typeList = new ArrayList<Class<?>>();
|
||||
Set<Long> usedKeys = new HashSet<Long>();
|
||||
ArrayList<Class<?>> typeList = new ArrayList<>();
|
||||
Set<Long> usedKeys = new HashSet<>();
|
||||
|
||||
|
||||
for (int i = 0; i < nfields; i++) {
|
||||
@ -2092,7 +2092,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
EntryFuture future = null;
|
||||
if (entry == null) {
|
||||
EntryFuture newEntry = new EntryFuture();
|
||||
Reference<?> newRef = new SoftReference<EntryFuture>(newEntry);
|
||||
Reference<?> newRef = new SoftReference<>(newEntry);
|
||||
do {
|
||||
if (ref != null) {
|
||||
Caches.reflectors.remove(key, ref);
|
||||
@ -2118,7 +2118,7 @@ public class ObjectStreamClass implements Serializable {
|
||||
entry = th;
|
||||
}
|
||||
future.set(entry);
|
||||
Caches.reflectors.put(key, new SoftReference<Object>(entry));
|
||||
Caches.reflectors.put(key, new SoftReference<>(entry));
|
||||
}
|
||||
|
||||
if (entry instanceof FieldReflector) {
|
||||
|
@ -47,7 +47,7 @@ class ApplicationShutdownHooks {
|
||||
}
|
||||
}
|
||||
);
|
||||
hooks = new IdentityHashMap<Thread, Thread>();
|
||||
hooks = new IdentityHashMap<>();
|
||||
} catch (IllegalStateException e) {
|
||||
// application shutdown hooks cannot be added if
|
||||
// shutdown is in progress.
|
||||
|
@ -648,8 +648,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
|
||||
*/
|
||||
public static final class UnicodeBlock extends Subset {
|
||||
|
||||
private static Map<String, UnicodeBlock> map
|
||||
= new HashMap<String, UnicodeBlock>(256);
|
||||
private static Map<String, UnicodeBlock> map = new HashMap<>(256);
|
||||
|
||||
/**
|
||||
* Creates a UnicodeBlock with the given identifier name.
|
||||
@ -4178,7 +4177,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
|
||||
|
||||
private static HashMap<String, Character.UnicodeScript> aliases;
|
||||
static {
|
||||
aliases = new HashMap<String, UnicodeScript>(128);
|
||||
aliases = new HashMap<>(128);
|
||||
aliases.put("ARAB", ARABIC);
|
||||
aliases.put("ARMI", IMPERIAL_ARAMAIC);
|
||||
aliases.put("ARMN", ARMENIAN);
|
||||
|
@ -81,7 +81,7 @@ class CharacterName {
|
||||
} while (cpOff < cpEnd);
|
||||
strPool = new byte[total - cpEnd];
|
||||
dis.readFully(strPool);
|
||||
refStrPool = new SoftReference<byte[]>(strPool);
|
||||
refStrPool = new SoftReference<>(strPool);
|
||||
} catch (Exception x) {
|
||||
throw new InternalError(x.getMessage());
|
||||
} finally {
|
||||
|
@ -1306,7 +1306,7 @@ public final
|
||||
return java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Class<?>[]>() {
|
||||
public Class[] run() {
|
||||
List<Class<?>> list = new ArrayList<Class<?>>();
|
||||
List<Class<?>> list = new ArrayList<>();
|
||||
Class<?> currentClass = Class.this;
|
||||
while (currentClass != null) {
|
||||
Class<?>[] members = currentClass.getDeclaredClasses();
|
||||
@ -2306,9 +2306,9 @@ public final
|
||||
res = Reflection.filterFields(this, getDeclaredFields0(publicOnly));
|
||||
if (useCaches) {
|
||||
if (publicOnly) {
|
||||
declaredPublicFields = new SoftReference<Field[]>(res);
|
||||
declaredPublicFields = new SoftReference<>(res);
|
||||
} else {
|
||||
declaredFields = new SoftReference<Field[]>(res);
|
||||
declaredFields = new SoftReference<>(res);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
@ -2330,9 +2330,9 @@ public final
|
||||
|
||||
// No cached value available; compute value recursively.
|
||||
// Traverse in correct order for getField().
|
||||
List<Field> fields = new ArrayList<Field>();
|
||||
List<Field> fields = new ArrayList<>();
|
||||
if (traversedInterfaces == null) {
|
||||
traversedInterfaces = new HashSet<Class<?>>();
|
||||
traversedInterfaces = new HashSet<>();
|
||||
}
|
||||
|
||||
// Local fields
|
||||
@ -2358,7 +2358,7 @@ public final
|
||||
res = new Field[fields.size()];
|
||||
fields.toArray(res);
|
||||
if (useCaches) {
|
||||
publicFields = new SoftReference<Field[]>(res);
|
||||
publicFields = new SoftReference<>(res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -2403,9 +2403,9 @@ public final
|
||||
}
|
||||
if (useCaches) {
|
||||
if (publicOnly) {
|
||||
publicConstructors = new SoftReference<Constructor<T>[]>(res);
|
||||
publicConstructors = new SoftReference<>(res);
|
||||
} else {
|
||||
declaredConstructors = new SoftReference<Constructor<T>[]>(res);
|
||||
declaredConstructors = new SoftReference<>(res);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
@ -2440,9 +2440,9 @@ public final
|
||||
res = Reflection.filterMethods(this, getDeclaredMethods0(publicOnly));
|
||||
if (useCaches) {
|
||||
if (publicOnly) {
|
||||
declaredPublicMethods = new SoftReference<Method[]>(res);
|
||||
declaredPublicMethods = new SoftReference<>(res);
|
||||
} else {
|
||||
declaredMethods = new SoftReference<Method[]>(res);
|
||||
declaredMethods = new SoftReference<>(res);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
@ -2598,7 +2598,7 @@ public final
|
||||
methods.compactAndTrim();
|
||||
res = methods.getArray();
|
||||
if (useCaches) {
|
||||
publicMethods = new SoftReference<Method[]>(res);
|
||||
publicMethods = new SoftReference<>(res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -2977,7 +2977,7 @@ public final
|
||||
if (universe == null)
|
||||
throw new IllegalArgumentException(
|
||||
getName() + " is not an enum type");
|
||||
Map<String, T> m = new HashMap<String, T>(2 * universe.length);
|
||||
Map<String, T> m = new HashMap<>(2 * universe.length);
|
||||
for (T constant : universe)
|
||||
m.put(((Enum<?>)constant).name(), constant);
|
||||
enumConstantDirectory = m;
|
||||
@ -3090,7 +3090,7 @@ public final
|
||||
if (superClass == null) {
|
||||
annotations = declaredAnnotations;
|
||||
} else {
|
||||
annotations = new HashMap<Class<? extends Annotation>, Annotation>();
|
||||
annotations = new HashMap<>();
|
||||
superClass.initAnnotationsIfNecessary();
|
||||
for (Map.Entry<Class<? extends Annotation>, Annotation> e : superClass.annotations.entrySet()) {
|
||||
Class<? extends Annotation> annotationClass = e.getKey();
|
||||
|
@ -247,7 +247,7 @@ public abstract class ClassLoader {
|
||||
|
||||
// The classes loaded by this class loader. The only purpose of this table
|
||||
// is to keep the classes from being GC'ed until the loader is GC'ed.
|
||||
private final Vector<Class<?>> classes = new Vector<Class<?>>();
|
||||
private final Vector<Class<?>> classes = new Vector<>();
|
||||
|
||||
// The "default" domain. Set as the default ProtectionDomain on newly
|
||||
// created classes.
|
||||
@ -266,8 +266,7 @@ public abstract class ClassLoader {
|
||||
// The packages defined in this class loader. Each package name is mapped
|
||||
// to its corresponding Package object.
|
||||
// @GuardedBy("itself")
|
||||
private final HashMap<String, Package> packages =
|
||||
new HashMap<String, Package>();
|
||||
private final HashMap<String, Package> packages = new HashMap<>();
|
||||
|
||||
private static Void checkCreateClassLoader() {
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
@ -280,16 +279,16 @@ public abstract class ClassLoader {
|
||||
private ClassLoader(Void unused, ClassLoader parent) {
|
||||
this.parent = parent;
|
||||
if (ParallelLoaders.isRegistered(this.getClass())) {
|
||||
parallelLockMap = new ConcurrentHashMap<String, Object>();
|
||||
package2certs = new ConcurrentHashMap<String, Certificate[]>();
|
||||
parallelLockMap = new ConcurrentHashMap<>();
|
||||
package2certs = new ConcurrentHashMap<>();
|
||||
domains =
|
||||
Collections.synchronizedSet(new HashSet<ProtectionDomain>());
|
||||
assertionLock = new Object();
|
||||
} else {
|
||||
// no finer-grained lock; lock on the classloader instance
|
||||
parallelLockMap = null;
|
||||
package2certs = new Hashtable<String, Certificate[]>();
|
||||
domains = new HashSet<ProtectionDomain>();
|
||||
package2certs = new Hashtable<>();
|
||||
domains = new HashSet<>();
|
||||
assertionLock = this;
|
||||
}
|
||||
}
|
||||
@ -1182,7 +1181,7 @@ public abstract class ClassLoader {
|
||||
}
|
||||
tmp[1] = findResources(name);
|
||||
|
||||
return new CompoundEnumeration<URL>(tmp);
|
||||
return new CompoundEnumeration<>(tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1657,7 +1656,7 @@ public abstract class ClassLoader {
|
||||
protected Package[] getPackages() {
|
||||
Map<String, Package> map;
|
||||
synchronized (packages) {
|
||||
map = new HashMap<String, Package>(packages);
|
||||
map = new HashMap<>(packages);
|
||||
}
|
||||
Package[] pkgs;
|
||||
if (parent != null) {
|
||||
@ -1764,20 +1763,17 @@ public abstract class ClassLoader {
|
||||
}
|
||||
|
||||
// All native library names we've loaded.
|
||||
private static Vector<String> loadedLibraryNames
|
||||
= new Vector<String>();
|
||||
private static Vector<String> loadedLibraryNames = new Vector<>();
|
||||
|
||||
// Native libraries belonging to system classes.
|
||||
private static Vector<NativeLibrary> systemNativeLibraries
|
||||
= new Vector<NativeLibrary>();
|
||||
= new Vector<>();
|
||||
|
||||
// Native libraries associated with the class loader.
|
||||
private Vector<NativeLibrary> nativeLibraries
|
||||
= new Vector<NativeLibrary>();
|
||||
private Vector<NativeLibrary> nativeLibraries = new Vector<>();
|
||||
|
||||
// native libraries being loaded/unloaded.
|
||||
private static Stack<NativeLibrary> nativeLibraryContext
|
||||
= new Stack<NativeLibrary>();
|
||||
private static Stack<NativeLibrary> nativeLibraryContext = new Stack<>();
|
||||
|
||||
// The paths searched for libraries
|
||||
private static String usr_paths[];
|
||||
@ -2101,8 +2097,8 @@ public abstract class ClassLoader {
|
||||
* them to empty maps, effectively ignoring any present settings.
|
||||
*/
|
||||
synchronized (assertionLock) {
|
||||
classAssertionStatus = new HashMap<String, Boolean>();
|
||||
packageAssertionStatus = new HashMap<String, Boolean>();
|
||||
classAssertionStatus = new HashMap<>();
|
||||
packageAssertionStatus = new HashMap<>();
|
||||
defaultAssertionStatus = false;
|
||||
}
|
||||
}
|
||||
@ -2164,8 +2160,8 @@ public abstract class ClassLoader {
|
||||
private void initializeJavaAssertionMaps() {
|
||||
// assert Thread.holdsLock(assertionLock);
|
||||
|
||||
classAssertionStatus = new HashMap<String, Boolean>();
|
||||
packageAssertionStatus = new HashMap<String, Boolean>();
|
||||
classAssertionStatus = new HashMap<>();
|
||||
packageAssertionStatus = new HashMap<>();
|
||||
AssertionStatusDirectives directives = retrieveDirectives();
|
||||
|
||||
for(int i = 0; i < directives.classes.length; i++)
|
||||
|
@ -588,16 +588,13 @@ public class Package implements java.lang.reflect.AnnotatedElement {
|
||||
}
|
||||
|
||||
// The map of loaded system packages
|
||||
private static Map<String, Package> pkgs
|
||||
= new HashMap<String, Package>(31);
|
||||
private static Map<String, Package> pkgs = new HashMap<>(31);
|
||||
|
||||
// Maps each directory or zip file name to its corresponding url
|
||||
private static Map<String, URL> urls
|
||||
= new HashMap<String, URL>(10);
|
||||
private static Map<String, URL> urls = new HashMap<>(10);
|
||||
|
||||
// Maps each code source url for a jar file to its manifest
|
||||
private static Map<String, Manifest> mans
|
||||
= new HashMap<String, Manifest>(10);
|
||||
private static Map<String, Manifest> mans = new HashMap<>(10);
|
||||
|
||||
private static native String getSystemPackage0(String name);
|
||||
private static native String[] getSystemPackages0();
|
||||
|
@ -214,7 +214,7 @@ public final class ProcessBuilder
|
||||
* @param command a string array containing the program and its arguments
|
||||
*/
|
||||
public ProcessBuilder(String... command) {
|
||||
this.command = new ArrayList<String>(command.length);
|
||||
this.command = new ArrayList<>(command.length);
|
||||
for (String arg : command)
|
||||
this.command.add(arg);
|
||||
}
|
||||
@ -251,7 +251,7 @@ public final class ProcessBuilder
|
||||
* @return this process builder
|
||||
*/
|
||||
public ProcessBuilder command(String... command) {
|
||||
this.command = new ArrayList<String>(command.length);
|
||||
this.command = new ArrayList<>(command.length);
|
||||
for (String arg : command)
|
||||
this.command.add(arg);
|
||||
return this;
|
||||
|
@ -2330,7 +2330,7 @@ public final class String
|
||||
int off = 0;
|
||||
int next = 0;
|
||||
boolean limited = limit > 0;
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
while ((next = indexOf(ch, off)) != -1) {
|
||||
if (!limited || list.size() < limit - 1) {
|
||||
list.add(substring(off, next));
|
||||
|
@ -53,9 +53,9 @@ class StringCoding {
|
||||
|
||||
/** The cached coders for each thread */
|
||||
private final static ThreadLocal<SoftReference<StringDecoder>> decoder =
|
||||
new ThreadLocal<SoftReference<StringDecoder>>();
|
||||
new ThreadLocal<>();
|
||||
private final static ThreadLocal<SoftReference<StringEncoder>> encoder =
|
||||
new ThreadLocal<SoftReference<StringEncoder>>();
|
||||
new ThreadLocal<>();
|
||||
|
||||
private static boolean warnUnsupportedCharset = true;
|
||||
|
||||
@ -67,7 +67,7 @@ class StringCoding {
|
||||
}
|
||||
|
||||
private static <T> void set(ThreadLocal<SoftReference<T>> tl, T ob) {
|
||||
tl.set(new SoftReference<T>(ob));
|
||||
tl.set(new SoftReference<>(ob));
|
||||
}
|
||||
|
||||
// Trim the given byte array to the given length
|
||||
|
@ -1642,8 +1642,7 @@ class Thread implements Runnable {
|
||||
// Get a snapshot of the list of all threads
|
||||
Thread[] threads = getThreads();
|
||||
StackTraceElement[][] traces = dumpThreads(threads);
|
||||
Map<Thread, StackTraceElement[]> m
|
||||
= new HashMap<Thread, StackTraceElement[]>(threads.length);
|
||||
Map<Thread, StackTraceElement[]> m = new HashMap<>(threads.length);
|
||||
for (int i = 0; i < threads.length; i++) {
|
||||
StackTraceElement[] stackTrace = traces[i];
|
||||
if (stackTrace != null) {
|
||||
@ -1664,11 +1663,11 @@ class Thread implements Runnable {
|
||||
private static class Caches {
|
||||
/** cache of subclass security audit results */
|
||||
static final ConcurrentMap<WeakClassKey,Boolean> subclassAudits =
|
||||
new ConcurrentHashMap<WeakClassKey,Boolean>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/** queue for WeakReferences to audited subclasses */
|
||||
static final ReferenceQueue<Class<?>> subclassAuditsQueue =
|
||||
new ReferenceQueue<Class<?>>();
|
||||
new ReferenceQueue<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -828,7 +828,7 @@ public class Throwable implements Serializable {
|
||||
// Use the sentinel for a zero-length list
|
||||
suppressed = SUPPRESSED_SENTINEL;
|
||||
} else { // Copy Throwables to new list
|
||||
suppressed = new ArrayList<Throwable>(1);
|
||||
suppressed = new ArrayList<>(1);
|
||||
for (Throwable t : suppressedExceptions) {
|
||||
// Enforce constraints on suppressed exceptions in
|
||||
// case of corrupt or malicious stream.
|
||||
@ -911,7 +911,7 @@ public class Throwable implements Serializable {
|
||||
return;
|
||||
|
||||
if (suppressedExceptions == SUPPRESSED_SENTINEL)
|
||||
suppressedExceptions = new ArrayList<Throwable>(1);
|
||||
suppressedExceptions = new ArrayList<>(1);
|
||||
|
||||
assert suppressedExceptions != SUPPRESSED_SENTINEL;
|
||||
|
||||
|
@ -794,7 +794,7 @@ public class ManagementFactory {
|
||||
*/
|
||||
public static List<Class<? extends PlatformManagedObject>> getAllPlatformMXBeanInterfaces() {
|
||||
List<Class<? extends PlatformManagedObject>> result =
|
||||
new ArrayList<Class<? extends PlatformManagedObject>>();
|
||||
new ArrayList<>();
|
||||
for (PlatformComponent component: PlatformComponent.values()) {
|
||||
result.add(component.getMXBeanInterface());
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ enum PlatformComponent {
|
||||
List<T> getGcMXBeanList(Class<T> gcMXBeanIntf) {
|
||||
List<GarbageCollectorMXBean> list =
|
||||
ManagementFactoryHelper.getGarbageCollectorMXBeans();
|
||||
List<T> result = new ArrayList<T>(list.size());
|
||||
List<T> result = new ArrayList<>(list.size());
|
||||
for (GarbageCollectorMXBean m : list) {
|
||||
if (gcMXBeanIntf.isInstance(m)) {
|
||||
result.add(gcMXBeanIntf.cast(m));
|
||||
@ -330,7 +330,7 @@ enum PlatformComponent {
|
||||
}
|
||||
|
||||
private static Set<String> keyProperties(String... keyNames) {
|
||||
Set<String> set = new HashSet<String>();
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("type");
|
||||
for (String s : keyNames) {
|
||||
set.add(s);
|
||||
@ -364,7 +364,7 @@ enum PlatformComponent {
|
||||
List<T> getMXBeans(MBeanServerConnection mbs, Class<T> mxbeanInterface)
|
||||
throws java.io.IOException
|
||||
{
|
||||
List<T> result = new ArrayList<T>();
|
||||
List<T> result = new ArrayList<>();
|
||||
for (ObjectName on : getObjectNames(mbs)) {
|
||||
result.add(ManagementFactory.
|
||||
newPlatformMXBeanProxy(mbs,
|
||||
|
@ -144,7 +144,7 @@ public final
|
||||
// which implicitly requires that new java.lang.reflect
|
||||
// objects be fabricated for each reflective call on Class
|
||||
// objects.)
|
||||
Constructor<T> res = new Constructor<T>(clazz,
|
||||
Constructor<T> res = new Constructor<>(clazz,
|
||||
parameterTypes,
|
||||
exceptionTypes, modifiers, slot,
|
||||
signature,
|
||||
|
@ -232,7 +232,7 @@ public class Proxy implements java.io.Serializable {
|
||||
|
||||
/** maps a class loader to the proxy class cache for that loader */
|
||||
private static Map<ClassLoader, Map<List<String>, Object>> loaderToCache
|
||||
= new WeakHashMap<ClassLoader, Map<List<String>, Object>>();
|
||||
= new WeakHashMap<>();
|
||||
|
||||
/** marks that a particular proxy class is currently being generated */
|
||||
private static Object pendingGenerationMarker = new Object();
|
||||
@ -356,7 +356,7 @@ public class Proxy implements java.io.Serializable {
|
||||
String[] interfaceNames = new String[interfaces.length];
|
||||
|
||||
// for detecting duplicates
|
||||
Set<Class<?>> interfaceSet = new HashSet<Class<?>>();
|
||||
Set<Class<?>> interfaceSet = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
/*
|
||||
@ -413,7 +413,7 @@ public class Proxy implements java.io.Serializable {
|
||||
synchronized (loaderToCache) {
|
||||
cache = loaderToCache.get(loader);
|
||||
if (cache == null) {
|
||||
cache = new HashMap<List<String>, Object>();
|
||||
cache = new HashMap<>();
|
||||
loaderToCache.put(loader, cache);
|
||||
}
|
||||
/*
|
||||
|
@ -84,7 +84,7 @@ class ReflectAccess implements sun.reflect.LangReflectAccess {
|
||||
byte[] annotations,
|
||||
byte[] parameterAnnotations)
|
||||
{
|
||||
return new Constructor<T>(declaringClass,
|
||||
return new Constructor<>(declaringClass,
|
||||
parameterTypes,
|
||||
checkedExceptions,
|
||||
modifiers,
|
||||
|
@ -364,7 +364,7 @@ public class DriverManager {
|
||||
* @return the list of JDBC Drivers loaded by the caller's class loader
|
||||
*/
|
||||
public static java.util.Enumeration<Driver> getDrivers() {
|
||||
java.util.Vector<Driver> result = new java.util.Vector<Driver>();
|
||||
java.util.Vector<Driver> result = new java.util.Vector<>();
|
||||
java.util.Vector drivers = null;
|
||||
|
||||
if (!initialized) {
|
||||
|
@ -482,8 +482,8 @@ public abstract class AbstractList<E> extends AbstractCollection<E> implements L
|
||||
*/
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return (this instanceof RandomAccess ?
|
||||
new RandomAccessSubList<E>(this, fromIndex, toIndex) :
|
||||
new SubList<E>(this, fromIndex, toIndex));
|
||||
new RandomAccessSubList<>(this, fromIndex, toIndex) :
|
||||
new SubList<>(this, fromIndex, toIndex));
|
||||
}
|
||||
|
||||
// Comparison and hashing
|
||||
@ -747,7 +747,7 @@ class SubList<E> extends AbstractList<E> {
|
||||
}
|
||||
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return new SubList<E>(this, fromIndex, toIndex);
|
||||
return new SubList<>(this, fromIndex, toIndex);
|
||||
}
|
||||
|
||||
private void rangeCheck(int index) {
|
||||
@ -776,6 +776,6 @@ class RandomAccessSubList<E> extends SubList<E> implements RandomAccess {
|
||||
}
|
||||
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return new RandomAccessSubList<E>(this, fromIndex, toIndex);
|
||||
return new RandomAccessSubList<>(this, fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
|
@ -2824,7 +2824,7 @@ public class Arrays {
|
||||
* @return a list view of the specified array
|
||||
*/
|
||||
public static <T> List<T> asList(T... a) {
|
||||
return new ArrayList<T>(a);
|
||||
return new ArrayList<>(a);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1035,7 +1035,7 @@ public class Collections {
|
||||
* @return an unmodifiable view of the specified collection.
|
||||
*/
|
||||
public static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c) {
|
||||
return new UnmodifiableCollection<T>(c);
|
||||
return new UnmodifiableCollection<>(c);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1109,7 +1109,7 @@ public class Collections {
|
||||
* @return an unmodifiable view of the specified set.
|
||||
*/
|
||||
public static <T> Set<T> unmodifiableSet(Set<? extends T> s) {
|
||||
return new UnmodifiableSet<T>(s);
|
||||
return new UnmodifiableSet<>(s);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1141,7 +1141,7 @@ public class Collections {
|
||||
* @return an unmodifiable view of the specified sorted set.
|
||||
*/
|
||||
public static <T> SortedSet<T> unmodifiableSortedSet(SortedSet<T> s) {
|
||||
return new UnmodifiableSortedSet<T>(s);
|
||||
return new UnmodifiableSortedSet<>(s);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1158,13 +1158,13 @@ public class Collections {
|
||||
public Comparator<? super E> comparator() {return ss.comparator();}
|
||||
|
||||
public SortedSet<E> subSet(E fromElement, E toElement) {
|
||||
return new UnmodifiableSortedSet<E>(ss.subSet(fromElement,toElement));
|
||||
return new UnmodifiableSortedSet<>(ss.subSet(fromElement,toElement));
|
||||
}
|
||||
public SortedSet<E> headSet(E toElement) {
|
||||
return new UnmodifiableSortedSet<E>(ss.headSet(toElement));
|
||||
return new UnmodifiableSortedSet<>(ss.headSet(toElement));
|
||||
}
|
||||
public SortedSet<E> tailSet(E fromElement) {
|
||||
return new UnmodifiableSortedSet<E>(ss.tailSet(fromElement));
|
||||
return new UnmodifiableSortedSet<>(ss.tailSet(fromElement));
|
||||
}
|
||||
|
||||
public E first() {return ss.first();}
|
||||
@ -1188,8 +1188,8 @@ public class Collections {
|
||||
*/
|
||||
public static <T> List<T> unmodifiableList(List<? extends T> list) {
|
||||
return (list instanceof RandomAccess ?
|
||||
new UnmodifiableRandomAccessList<T>(list) :
|
||||
new UnmodifiableList<T>(list));
|
||||
new UnmodifiableRandomAccessList<>(list) :
|
||||
new UnmodifiableList<>(list));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1250,7 +1250,7 @@ public class Collections {
|
||||
}
|
||||
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return new UnmodifiableList<E>(list.subList(fromIndex, toIndex));
|
||||
return new UnmodifiableList<>(list.subList(fromIndex, toIndex));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1267,7 +1267,7 @@ public class Collections {
|
||||
*/
|
||||
private Object readResolve() {
|
||||
return (list instanceof RandomAccess
|
||||
? new UnmodifiableRandomAccessList<E>(list)
|
||||
? new UnmodifiableRandomAccessList<>(list)
|
||||
: this);
|
||||
}
|
||||
}
|
||||
@ -1283,7 +1283,7 @@ public class Collections {
|
||||
}
|
||||
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return new UnmodifiableRandomAccessList<E>(
|
||||
return new UnmodifiableRandomAccessList<>(
|
||||
list.subList(fromIndex, toIndex));
|
||||
}
|
||||
|
||||
@ -1296,7 +1296,7 @@ public class Collections {
|
||||
* deserialization.
|
||||
*/
|
||||
private Object writeReplace() {
|
||||
return new UnmodifiableList<E>(list);
|
||||
return new UnmodifiableList<>(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1315,7 +1315,7 @@ public class Collections {
|
||||
* @return an unmodifiable view of the specified map.
|
||||
*/
|
||||
public static <K,V> Map<K,V> unmodifiableMap(Map<? extends K, ? extends V> m) {
|
||||
return new UnmodifiableMap<K,V>(m);
|
||||
return new UnmodifiableMap<>(m);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1363,7 +1363,7 @@ public class Collections {
|
||||
|
||||
public Set<Map.Entry<K,V>> entrySet() {
|
||||
if (entrySet==null)
|
||||
entrySet = new UnmodifiableEntrySet<K,V>(m.entrySet());
|
||||
entrySet = new UnmodifiableEntrySet<>(m.entrySet());
|
||||
return entrySet;
|
||||
}
|
||||
|
||||
@ -1400,7 +1400,7 @@ public class Collections {
|
||||
return i.hasNext();
|
||||
}
|
||||
public Map.Entry<K,V> next() {
|
||||
return new UnmodifiableEntry<K,V>(i.next());
|
||||
return new UnmodifiableEntry<>(i.next());
|
||||
}
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
@ -1411,7 +1411,7 @@ public class Collections {
|
||||
public Object[] toArray() {
|
||||
Object[] a = c.toArray();
|
||||
for (int i=0; i<a.length; i++)
|
||||
a[i] = new UnmodifiableEntry<K,V>((Map.Entry<K,V>)a[i]);
|
||||
a[i] = new UnmodifiableEntry<>((Map.Entry<K,V>)a[i]);
|
||||
return a;
|
||||
}
|
||||
|
||||
@ -1422,7 +1422,7 @@ public class Collections {
|
||||
Object[] arr = c.toArray(a.length==0 ? a : Arrays.copyOf(a, 0));
|
||||
|
||||
for (int i=0; i<arr.length; i++)
|
||||
arr[i] = new UnmodifiableEntry<K,V>((Map.Entry<K,V>)arr[i]);
|
||||
arr[i] = new UnmodifiableEntry<>((Map.Entry<K,V>)arr[i]);
|
||||
|
||||
if (arr.length > a.length)
|
||||
return (T[])arr;
|
||||
@ -1443,7 +1443,7 @@ public class Collections {
|
||||
if (!(o instanceof Map.Entry))
|
||||
return false;
|
||||
return c.contains(
|
||||
new UnmodifiableEntry<Object,Object>((Map.Entry<?,?>) o));
|
||||
new UnmodifiableEntry<>((Map.Entry<?,?>) o));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1517,7 +1517,7 @@ public class Collections {
|
||||
* @return an unmodifiable view of the specified sorted map.
|
||||
*/
|
||||
public static <K,V> SortedMap<K,V> unmodifiableSortedMap(SortedMap<K, ? extends V> m) {
|
||||
return new UnmodifiableSortedMap<K,V>(m);
|
||||
return new UnmodifiableSortedMap<>(m);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1535,13 +1535,13 @@ public class Collections {
|
||||
public Comparator<? super K> comparator() {return sm.comparator();}
|
||||
|
||||
public SortedMap<K,V> subMap(K fromKey, K toKey) {
|
||||
return new UnmodifiableSortedMap<K,V>(sm.subMap(fromKey, toKey));
|
||||
return new UnmodifiableSortedMap<>(sm.subMap(fromKey, toKey));
|
||||
}
|
||||
public SortedMap<K,V> headMap(K toKey) {
|
||||
return new UnmodifiableSortedMap<K,V>(sm.headMap(toKey));
|
||||
return new UnmodifiableSortedMap<>(sm.headMap(toKey));
|
||||
}
|
||||
public SortedMap<K,V> tailMap(K fromKey) {
|
||||
return new UnmodifiableSortedMap<K,V>(sm.tailMap(fromKey));
|
||||
return new UnmodifiableSortedMap<>(sm.tailMap(fromKey));
|
||||
}
|
||||
|
||||
public K firstKey() {return sm.firstKey();}
|
||||
@ -1583,11 +1583,11 @@ public class Collections {
|
||||
* @return a synchronized view of the specified collection.
|
||||
*/
|
||||
public static <T> Collection<T> synchronizedCollection(Collection<T> c) {
|
||||
return new SynchronizedCollection<T>(c);
|
||||
return new SynchronizedCollection<>(c);
|
||||
}
|
||||
|
||||
static <T> Collection<T> synchronizedCollection(Collection<T> c, Object mutex) {
|
||||
return new SynchronizedCollection<T>(c, mutex);
|
||||
return new SynchronizedCollection<>(c, mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1686,11 +1686,11 @@ public class Collections {
|
||||
* @return a synchronized view of the specified set.
|
||||
*/
|
||||
public static <T> Set<T> synchronizedSet(Set<T> s) {
|
||||
return new SynchronizedSet<T>(s);
|
||||
return new SynchronizedSet<>(s);
|
||||
}
|
||||
|
||||
static <T> Set<T> synchronizedSet(Set<T> s, Object mutex) {
|
||||
return new SynchronizedSet<T>(s, mutex);
|
||||
return new SynchronizedSet<>(s, mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1754,7 +1754,7 @@ public class Collections {
|
||||
* @return a synchronized view of the specified sorted set.
|
||||
*/
|
||||
public static <T> SortedSet<T> synchronizedSortedSet(SortedSet<T> s) {
|
||||
return new SynchronizedSortedSet<T>(s);
|
||||
return new SynchronizedSortedSet<>(s);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1783,18 +1783,18 @@ public class Collections {
|
||||
|
||||
public SortedSet<E> subSet(E fromElement, E toElement) {
|
||||
synchronized (mutex) {
|
||||
return new SynchronizedSortedSet<E>(
|
||||
return new SynchronizedSortedSet<>(
|
||||
ss.subSet(fromElement, toElement), mutex);
|
||||
}
|
||||
}
|
||||
public SortedSet<E> headSet(E toElement) {
|
||||
synchronized (mutex) {
|
||||
return new SynchronizedSortedSet<E>(ss.headSet(toElement), mutex);
|
||||
return new SynchronizedSortedSet<>(ss.headSet(toElement), mutex);
|
||||
}
|
||||
}
|
||||
public SortedSet<E> tailSet(E fromElement) {
|
||||
synchronized (mutex) {
|
||||
return new SynchronizedSortedSet<E>(ss.tailSet(fromElement),mutex);
|
||||
return new SynchronizedSortedSet<>(ss.tailSet(fromElement),mutex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1833,14 +1833,14 @@ public class Collections {
|
||||
*/
|
||||
public static <T> List<T> synchronizedList(List<T> list) {
|
||||
return (list instanceof RandomAccess ?
|
||||
new SynchronizedRandomAccessList<T>(list) :
|
||||
new SynchronizedList<T>(list));
|
||||
new SynchronizedRandomAccessList<>(list) :
|
||||
new SynchronizedList<>(list));
|
||||
}
|
||||
|
||||
static <T> List<T> synchronizedList(List<T> list, Object mutex) {
|
||||
return (list instanceof RandomAccess ?
|
||||
new SynchronizedRandomAccessList<T>(list, mutex) :
|
||||
new SynchronizedList<T>(list, mutex));
|
||||
new SynchronizedRandomAccessList<>(list, mutex) :
|
||||
new SynchronizedList<>(list, mutex));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1903,7 +1903,7 @@ public class Collections {
|
||||
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
synchronized (mutex) {
|
||||
return new SynchronizedList<E>(list.subList(fromIndex, toIndex),
|
||||
return new SynchronizedList<>(list.subList(fromIndex, toIndex),
|
||||
mutex);
|
||||
}
|
||||
}
|
||||
@ -1922,7 +1922,7 @@ public class Collections {
|
||||
*/
|
||||
private Object readResolve() {
|
||||
return (list instanceof RandomAccess
|
||||
? new SynchronizedRandomAccessList<E>(list)
|
||||
? new SynchronizedRandomAccessList<>(list)
|
||||
: this);
|
||||
}
|
||||
}
|
||||
@ -1944,7 +1944,7 @@ public class Collections {
|
||||
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
synchronized (mutex) {
|
||||
return new SynchronizedRandomAccessList<E>(
|
||||
return new SynchronizedRandomAccessList<>(
|
||||
list.subList(fromIndex, toIndex), mutex);
|
||||
}
|
||||
}
|
||||
@ -1958,7 +1958,7 @@ public class Collections {
|
||||
* deserialization.
|
||||
*/
|
||||
private Object writeReplace() {
|
||||
return new SynchronizedList<E>(list);
|
||||
return new SynchronizedList<>(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1990,7 +1990,7 @@ public class Collections {
|
||||
* @return a synchronized view of the specified map.
|
||||
*/
|
||||
public static <K,V> Map<K,V> synchronizedMap(Map<K,V> m) {
|
||||
return new SynchronizedMap<K,V>(m);
|
||||
return new SynchronizedMap<>(m);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2051,7 +2051,7 @@ public class Collections {
|
||||
public Set<K> keySet() {
|
||||
synchronized (mutex) {
|
||||
if (keySet==null)
|
||||
keySet = new SynchronizedSet<K>(m.keySet(), mutex);
|
||||
keySet = new SynchronizedSet<>(m.keySet(), mutex);
|
||||
return keySet;
|
||||
}
|
||||
}
|
||||
@ -2059,7 +2059,7 @@ public class Collections {
|
||||
public Set<Map.Entry<K,V>> entrySet() {
|
||||
synchronized (mutex) {
|
||||
if (entrySet==null)
|
||||
entrySet = new SynchronizedSet<Map.Entry<K,V>>(m.entrySet(), mutex);
|
||||
entrySet = new SynchronizedSet<>(m.entrySet(), mutex);
|
||||
return entrySet;
|
||||
}
|
||||
}
|
||||
@ -2067,7 +2067,7 @@ public class Collections {
|
||||
public Collection<V> values() {
|
||||
synchronized (mutex) {
|
||||
if (values==null)
|
||||
values = new SynchronizedCollection<V>(m.values(), mutex);
|
||||
values = new SynchronizedCollection<>(m.values(), mutex);
|
||||
return values;
|
||||
}
|
||||
}
|
||||
@ -2129,7 +2129,7 @@ public class Collections {
|
||||
* @return a synchronized view of the specified sorted map.
|
||||
*/
|
||||
public static <K,V> SortedMap<K,V> synchronizedSortedMap(SortedMap<K,V> m) {
|
||||
return new SynchronizedSortedMap<K,V>(m);
|
||||
return new SynchronizedSortedMap<>(m);
|
||||
}
|
||||
|
||||
|
||||
@ -2159,18 +2159,18 @@ public class Collections {
|
||||
|
||||
public SortedMap<K,V> subMap(K fromKey, K toKey) {
|
||||
synchronized (mutex) {
|
||||
return new SynchronizedSortedMap<K,V>(
|
||||
return new SynchronizedSortedMap<>(
|
||||
sm.subMap(fromKey, toKey), mutex);
|
||||
}
|
||||
}
|
||||
public SortedMap<K,V> headMap(K toKey) {
|
||||
synchronized (mutex) {
|
||||
return new SynchronizedSortedMap<K,V>(sm.headMap(toKey), mutex);
|
||||
return new SynchronizedSortedMap<>(sm.headMap(toKey), mutex);
|
||||
}
|
||||
}
|
||||
public SortedMap<K,V> tailMap(K fromKey) {
|
||||
synchronized (mutex) {
|
||||
return new SynchronizedSortedMap<K,V>(sm.tailMap(fromKey),mutex);
|
||||
return new SynchronizedSortedMap<>(sm.tailMap(fromKey),mutex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2246,7 +2246,7 @@ public class Collections {
|
||||
*/
|
||||
public static <E> Collection<E> checkedCollection(Collection<E> c,
|
||||
Class<E> type) {
|
||||
return new CheckedCollection<E>(c, type);
|
||||
return new CheckedCollection<>(c, type);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -2378,7 +2378,7 @@ public class Collections {
|
||||
* @since 1.5
|
||||
*/
|
||||
public static <E> Set<E> checkedSet(Set<E> s, Class<E> type) {
|
||||
return new CheckedSet<E>(s, type);
|
||||
return new CheckedSet<>(s, type);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2424,7 +2424,7 @@ public class Collections {
|
||||
*/
|
||||
public static <E> SortedSet<E> checkedSortedSet(SortedSet<E> s,
|
||||
Class<E> type) {
|
||||
return new CheckedSortedSet<E>(s, type);
|
||||
return new CheckedSortedSet<>(s, type);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2484,8 +2484,8 @@ public class Collections {
|
||||
*/
|
||||
public static <E> List<E> checkedList(List<E> list, Class<E> type) {
|
||||
return (list instanceof RandomAccess ?
|
||||
new CheckedRandomAccessList<E>(list, type) :
|
||||
new CheckedList<E>(list, type));
|
||||
new CheckedRandomAccessList<>(list, type) :
|
||||
new CheckedList<>(list, type));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2550,7 +2550,7 @@ public class Collections {
|
||||
}
|
||||
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return new CheckedList<E>(list.subList(fromIndex, toIndex), type);
|
||||
return new CheckedList<>(list.subList(fromIndex, toIndex), type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2567,7 +2567,7 @@ public class Collections {
|
||||
}
|
||||
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return new CheckedRandomAccessList<E>(
|
||||
return new CheckedRandomAccessList<>(
|
||||
list.subList(fromIndex, toIndex), type);
|
||||
}
|
||||
}
|
||||
@ -2609,7 +2609,7 @@ public class Collections {
|
||||
public static <K, V> Map<K, V> checkedMap(Map<K, V> m,
|
||||
Class<K> keyType,
|
||||
Class<V> valueType) {
|
||||
return new CheckedMap<K,V>(m, keyType, valueType);
|
||||
return new CheckedMap<>(m, keyType, valueType);
|
||||
}
|
||||
|
||||
|
||||
@ -2677,15 +2677,14 @@ public class Collections {
|
||||
// - protection from malicious t
|
||||
// - correct behavior if t is a concurrent map
|
||||
Object[] entries = t.entrySet().toArray();
|
||||
List<Map.Entry<K,V>> checked =
|
||||
new ArrayList<Map.Entry<K,V>>(entries.length);
|
||||
List<Map.Entry<K,V>> checked = new ArrayList<>(entries.length);
|
||||
for (Object o : entries) {
|
||||
Map.Entry<?,?> e = (Map.Entry<?,?>) o;
|
||||
Object k = e.getKey();
|
||||
Object v = e.getValue();
|
||||
typeCheck(k, v);
|
||||
checked.add(
|
||||
new AbstractMap.SimpleImmutableEntry<K,V>((K) k, (V) v));
|
||||
new AbstractMap.SimpleImmutableEntry<>((K) k, (V) v));
|
||||
}
|
||||
for (Map.Entry<K,V> e : checked)
|
||||
m.put(e.getKey(), e.getValue());
|
||||
@ -2695,7 +2694,7 @@ public class Collections {
|
||||
|
||||
public Set<Map.Entry<K,V>> entrySet() {
|
||||
if (entrySet==null)
|
||||
entrySet = new CheckedEntrySet<K,V>(m.entrySet(), valueType);
|
||||
entrySet = new CheckedEntrySet<>(m.entrySet(), valueType);
|
||||
return entrySet;
|
||||
}
|
||||
|
||||
@ -2810,7 +2809,7 @@ public class Collections {
|
||||
if (!(o instanceof Map.Entry))
|
||||
return false;
|
||||
return s.remove(new AbstractMap.SimpleImmutableEntry
|
||||
<Object, Object>((Map.Entry<?,?>)o));
|
||||
<>((Map.Entry<?,?>)o));
|
||||
}
|
||||
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
@ -2843,7 +2842,7 @@ public class Collections {
|
||||
|
||||
static <K,V,T> CheckedEntry<K,V,T> checkedEntry(Map.Entry<K,V> e,
|
||||
Class<T> valueType) {
|
||||
return new CheckedEntry<K,V,T>(e, valueType);
|
||||
return new CheckedEntry<>(e, valueType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2884,7 +2883,7 @@ public class Collections {
|
||||
if (!(o instanceof Map.Entry))
|
||||
return false;
|
||||
return e.equals(new AbstractMap.SimpleImmutableEntry
|
||||
<Object, Object>((Map.Entry<?,?>)o));
|
||||
<>((Map.Entry<?,?>)o));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2927,7 +2926,7 @@ public class Collections {
|
||||
public static <K,V> SortedMap<K,V> checkedSortedMap(SortedMap<K, V> m,
|
||||
Class<K> keyType,
|
||||
Class<V> valueType) {
|
||||
return new CheckedSortedMap<K,V>(m, keyType, valueType);
|
||||
return new CheckedSortedMap<>(m, keyType, valueType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2993,7 +2992,7 @@ public class Collections {
|
||||
|
||||
private static class EmptyIterator<E> implements Iterator<E> {
|
||||
static final EmptyIterator<Object> EMPTY_ITERATOR
|
||||
= new EmptyIterator<Object>();
|
||||
= new EmptyIterator<>();
|
||||
|
||||
public boolean hasNext() { return false; }
|
||||
public E next() { throw new NoSuchElementException(); }
|
||||
@ -3042,7 +3041,7 @@ public class Collections {
|
||||
implements ListIterator<E>
|
||||
{
|
||||
static final EmptyListIterator<Object> EMPTY_ITERATOR
|
||||
= new EmptyListIterator<Object>();
|
||||
= new EmptyListIterator<>();
|
||||
|
||||
public boolean hasPrevious() { return false; }
|
||||
public E previous() { throw new NoSuchElementException(); }
|
||||
@ -3078,7 +3077,7 @@ public class Collections {
|
||||
|
||||
private static class EmptyEnumeration<E> implements Enumeration<E> {
|
||||
static final EmptyEnumeration<Object> EMPTY_ENUMERATION
|
||||
= new EmptyEnumeration<Object>();
|
||||
= new EmptyEnumeration<>();
|
||||
|
||||
public boolean hasMoreElements() { return false; }
|
||||
public E nextElement() { throw new NoSuchElementException(); }
|
||||
@ -3090,7 +3089,7 @@ public class Collections {
|
||||
* @see #emptySet()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final Set EMPTY_SET = new EmptySet<Object>();
|
||||
public static final Set EMPTY_SET = new EmptySet<>();
|
||||
|
||||
/**
|
||||
* Returns the empty set (immutable). This set is serializable.
|
||||
@ -3150,7 +3149,7 @@ public class Collections {
|
||||
* @see #emptyList()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final List EMPTY_LIST = new EmptyList<Object>();
|
||||
public static final List EMPTY_LIST = new EmptyList<>();
|
||||
|
||||
/**
|
||||
* Returns the empty list (immutable). This list is serializable.
|
||||
@ -3224,7 +3223,7 @@ public class Collections {
|
||||
* @since 1.3
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final Map EMPTY_MAP = new EmptyMap<Object,Object>();
|
||||
public static final Map EMPTY_MAP = new EmptyMap<>();
|
||||
|
||||
/**
|
||||
* Returns the empty map (immutable). This map is serializable.
|
||||
@ -3286,7 +3285,7 @@ public class Collections {
|
||||
* @return an immutable set containing only the specified object.
|
||||
*/
|
||||
public static <T> Set<T> singleton(T o) {
|
||||
return new SingletonSet<T>(o);
|
||||
return new SingletonSet<>(o);
|
||||
}
|
||||
|
||||
static <E> Iterator<E> singletonIterator(final E e) {
|
||||
@ -3339,7 +3338,7 @@ public class Collections {
|
||||
* @since 1.3
|
||||
*/
|
||||
public static <T> List<T> singletonList(T o) {
|
||||
return new SingletonList<T>(o);
|
||||
return new SingletonList<>(o);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3381,7 +3380,7 @@ public class Collections {
|
||||
* @since 1.3
|
||||
*/
|
||||
public static <K,V> Map<K,V> singletonMap(K key, V value) {
|
||||
return new SingletonMap<K,V>(key, value);
|
||||
return new SingletonMap<>(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3423,7 +3422,7 @@ public class Collections {
|
||||
public Set<Map.Entry<K,V>> entrySet() {
|
||||
if (entrySet==null)
|
||||
entrySet = Collections.<Map.Entry<K,V>>singleton(
|
||||
new SimpleImmutableEntry<K,V>(k, v));
|
||||
new SimpleImmutableEntry<>(k, v));
|
||||
return entrySet;
|
||||
}
|
||||
|
||||
@ -3455,7 +3454,7 @@ public class Collections {
|
||||
public static <T> List<T> nCopies(int n, T o) {
|
||||
if (n < 0)
|
||||
throw new IllegalArgumentException("List length = " + n);
|
||||
return new CopiesList<T>(n, o);
|
||||
return new CopiesList<>(n, o);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3529,7 +3528,7 @@ public class Collections {
|
||||
if (fromIndex > toIndex)
|
||||
throw new IllegalArgumentException("fromIndex(" + fromIndex +
|
||||
") > toIndex(" + toIndex + ")");
|
||||
return new CopiesList<E>(toIndex - fromIndex, element);
|
||||
return new CopiesList<>(toIndex - fromIndex, element);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3595,7 +3594,7 @@ public class Collections {
|
||||
if (cmp instanceof ReverseComparator2)
|
||||
return ((ReverseComparator2<T>)cmp).cmp;
|
||||
|
||||
return new ReverseComparator2<T>(cmp);
|
||||
return new ReverseComparator2<>(cmp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3674,7 +3673,7 @@ public class Collections {
|
||||
* @see ArrayList
|
||||
*/
|
||||
public static <T> ArrayList<T> list(Enumeration<T> e) {
|
||||
ArrayList<T> l = new ArrayList<T>();
|
||||
ArrayList<T> l = new ArrayList<>();
|
||||
while (e.hasMoreElements())
|
||||
l.add(e.nextElement());
|
||||
return l;
|
||||
@ -3819,7 +3818,7 @@ public class Collections {
|
||||
* @since 1.6
|
||||
*/
|
||||
public static <E> Set<E> newSetFromMap(Map<E, Boolean> map) {
|
||||
return new SetFromMap<E>(map);
|
||||
return new SetFromMap<>(map);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3883,7 +3882,7 @@ public class Collections {
|
||||
* @since 1.6
|
||||
*/
|
||||
public static <T> Queue<T> asLifoQueue(Deque<T> deque) {
|
||||
return new AsLIFOQueue<T>(deque);
|
||||
return new AsLIFOQueue<>(deque);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -499,7 +499,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
int j = 0;
|
||||
for (int i = 0; i < vals.length; i++)
|
||||
if (vals[i] != null)
|
||||
a[j++] = new AbstractMap.SimpleEntry<K,V>(
|
||||
a[j++] = new AbstractMap.SimpleEntry<>(
|
||||
keyUniverse[i], unmaskNull(vals[i]));
|
||||
return a;
|
||||
}
|
||||
|
@ -110,9 +110,9 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
throw new ClassCastException(elementType + " not an enum");
|
||||
|
||||
if (universe.length <= 64)
|
||||
return new RegularEnumSet<E>(elementType, universe);
|
||||
return new RegularEnumSet<>(elementType, universe);
|
||||
else
|
||||
return new JumboEnumSet<E>(elementType, universe);
|
||||
return new JumboEnumSet<>(elementType, universe);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -430,7 +430,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
}
|
||||
|
||||
Object writeReplace() {
|
||||
return new SerializationProxy<E>(this);
|
||||
return new SerializationProxy<>(this);
|
||||
}
|
||||
|
||||
// readObject method for the serialization proxy pattern
|
||||
|
@ -2490,7 +2490,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
* Finds format specifiers in the format string.
|
||||
*/
|
||||
private FormatString[] parse(String s) {
|
||||
ArrayList<FormatString> al = new ArrayList<FormatString>();
|
||||
ArrayList<FormatString> al = new ArrayList<>();
|
||||
Matcher m = fsPattern.matcher(s);
|
||||
for (int i = 0, len = s.length(); i < len; ) {
|
||||
if (m.find(i)) {
|
||||
|
@ -763,7 +763,7 @@ public class HashMap<K,V>
|
||||
*/
|
||||
void addEntry(int hash, K key, V value, int bucketIndex) {
|
||||
Entry<K,V> e = table[bucketIndex];
|
||||
table[bucketIndex] = new Entry<K,V>(hash, key, value, e);
|
||||
table[bucketIndex] = new Entry<>(hash, key, value, e);
|
||||
if (size++ >= threshold)
|
||||
resize(2 * table.length);
|
||||
}
|
||||
@ -778,7 +778,7 @@ public class HashMap<K,V>
|
||||
*/
|
||||
void createEntry(int hash, K key, V value, int bucketIndex) {
|
||||
Entry<K,V> e = table[bucketIndex];
|
||||
table[bucketIndex] = new Entry<K,V>(hash, key, value, e);
|
||||
table[bucketIndex] = new Entry<>(hash, key, value, e);
|
||||
size++;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class HashSet<E>
|
||||
* default initial capacity (16) and load factor (0.75).
|
||||
*/
|
||||
public HashSet() {
|
||||
map = new HashMap<E,Object>();
|
||||
map = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,7 +113,7 @@ public class HashSet<E>
|
||||
* @throws NullPointerException if the specified collection is null
|
||||
*/
|
||||
public HashSet(Collection<? extends E> c) {
|
||||
map = new HashMap<E,Object>(Math.max((int) (c.size()/.75f) + 1, 16));
|
||||
map = new HashMap<>(Math.max((int) (c.size()/.75f) + 1, 16));
|
||||
addAll(c);
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ public class HashSet<E>
|
||||
* than zero, or if the load factor is nonpositive
|
||||
*/
|
||||
public HashSet(int initialCapacity, float loadFactor) {
|
||||
map = new HashMap<E,Object>(initialCapacity, loadFactor);
|
||||
map = new HashMap<>(initialCapacity, loadFactor);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,7 +139,7 @@ public class HashSet<E>
|
||||
* than zero
|
||||
*/
|
||||
public HashSet(int initialCapacity) {
|
||||
map = new HashMap<E,Object>(initialCapacity);
|
||||
map = new HashMap<>(initialCapacity);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +156,7 @@ public class HashSet<E>
|
||||
* than zero, or if the load factor is nonpositive
|
||||
*/
|
||||
HashSet(int initialCapacity, float loadFactor, boolean dummy) {
|
||||
map = new LinkedHashMap<E,Object>(initialCapacity, loadFactor);
|
||||
map = new LinkedHashMap<>(initialCapacity, loadFactor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -455,7 +455,7 @@ public class Hashtable<K,V>
|
||||
|
||||
// Creates the new entry.
|
||||
Entry<K,V> e = tab[index];
|
||||
tab[index] = new Entry<K,V>(hash, key, value, e);
|
||||
tab[index] = new Entry<>(hash, key, value, e);
|
||||
count++;
|
||||
return null;
|
||||
}
|
||||
@ -579,7 +579,7 @@ public class Hashtable<K,V>
|
||||
if (count == 0) {
|
||||
return Collections.emptyEnumeration();
|
||||
} else {
|
||||
return new Enumerator<T>(type, false);
|
||||
return new Enumerator<>(type, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -587,7 +587,7 @@ public class Hashtable<K,V>
|
||||
if (count == 0) {
|
||||
return Collections.emptyIterator();
|
||||
} else {
|
||||
return new Enumerator<T>(type, true);
|
||||
return new Enumerator<>(type, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -929,7 +929,7 @@ public class Hashtable<K,V>
|
||||
}
|
||||
// Creates the new entry.
|
||||
Entry<K,V> e = tab[index];
|
||||
tab[index] = new Entry<K,V>(hash, key, value, e);
|
||||
tab[index] = new Entry<>(hash, key, value, e);
|
||||
count++;
|
||||
}
|
||||
|
||||
@ -950,7 +950,7 @@ public class Hashtable<K,V>
|
||||
}
|
||||
|
||||
protected Object clone() {
|
||||
return new Entry<K,V>(hash, key, value,
|
||||
return new Entry<>(hash, key, value,
|
||||
(next==null ? null : (Entry<K,V>) next.clone()));
|
||||
}
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ public class IdentityHashMap<K,V>
|
||||
Object[] result = new Object[size];
|
||||
Iterator<Map.Entry<K,V>> it = iterator();
|
||||
for (int i = 0; i < size; i++)
|
||||
result[i] = new AbstractMap.SimpleEntry<K,V>(it.next());
|
||||
result[i] = new AbstractMap.SimpleEntry<>(it.next());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1146,7 +1146,7 @@ public class IdentityHashMap<K,V>
|
||||
.newInstance(a.getClass().getComponentType(), size);
|
||||
Iterator<Map.Entry<K,V>> it = iterator();
|
||||
for (int i = 0; i < size; i++)
|
||||
a[i] = (T) new AbstractMap.SimpleEntry<K,V>(it.next());
|
||||
a[i] = (T) new AbstractMap.SimpleEntry<>(it.next());
|
||||
if (a.length > size)
|
||||
a[size] = null;
|
||||
return a;
|
||||
|
@ -89,7 +89,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* @return an iterator over the elements contained in this set
|
||||
*/
|
||||
public Iterator<E> iterator() {
|
||||
return new EnumSetIterator<E>();
|
||||
return new EnumSetIterator<>();
|
||||
}
|
||||
|
||||
private class EnumSetIterator<E extends Enum<E>> implements Iterator<E> {
|
||||
|
@ -237,7 +237,7 @@ public class LinkedHashMap<K,V>
|
||||
* the chain.
|
||||
*/
|
||||
void init() {
|
||||
header = new Entry<K,V>(-1, null, null, null);
|
||||
header = new Entry<>(-1, null, null, null);
|
||||
header.before = header.after = header;
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ public class LinkedHashMap<K,V>
|
||||
*/
|
||||
void createEntry(int hash, K key, V value, int bucketIndex) {
|
||||
HashMap.Entry<K,V> old = table[bucketIndex];
|
||||
Entry<K,V> e = new Entry<K,V>(hash, key, value, old);
|
||||
Entry<K,V> e = new Entry<>(hash, key, value, old);
|
||||
table[bucketIndex] = e;
|
||||
e.addBefore(header);
|
||||
size++;
|
||||
|
@ -122,7 +122,7 @@ public class LinkedList<E>
|
||||
*/
|
||||
private void linkFirst(E e) {
|
||||
final Node<E> f = first;
|
||||
final Node<E> newNode = new Node<E>(null, e, f);
|
||||
final Node<E> newNode = new Node<>(null, e, f);
|
||||
first = newNode;
|
||||
if (f == null)
|
||||
last = newNode;
|
||||
@ -137,7 +137,7 @@ public class LinkedList<E>
|
||||
*/
|
||||
void linkLast(E e) {
|
||||
final Node<E> l = last;
|
||||
final Node<E> newNode = new Node<E>(l, e, null);
|
||||
final Node<E> newNode = new Node<>(l, e, null);
|
||||
last = newNode;
|
||||
if (l == null)
|
||||
first = newNode;
|
||||
@ -153,7 +153,7 @@ public class LinkedList<E>
|
||||
void linkBefore(E e, Node<E> succ) {
|
||||
// assert succ != null;
|
||||
final Node<E> pred = succ.prev;
|
||||
final Node<E> newNode = new Node<E>(pred, e, succ);
|
||||
final Node<E> newNode = new Node<>(pred, e, succ);
|
||||
succ.prev = newNode;
|
||||
if (pred == null)
|
||||
first = newNode;
|
||||
@ -419,7 +419,7 @@ public class LinkedList<E>
|
||||
|
||||
for (Object o : a) {
|
||||
@SuppressWarnings("unchecked") E e = (E) o;
|
||||
Node<E> newNode = new Node<E>(pred, e, null);
|
||||
Node<E> newNode = new Node<>(pred, e, null);
|
||||
if (pred == null)
|
||||
first = newNode;
|
||||
else
|
||||
|
@ -187,7 +187,7 @@ public abstract class ListResourceBundle extends ResourceBundle {
|
||||
return;
|
||||
|
||||
Object[][] contents = getContents();
|
||||
HashMap<String,Object> temp = new HashMap<String,Object>(contents.length);
|
||||
HashMap<String,Object> temp = new HashMap<>(contents.length);
|
||||
for (int i = 0; i < contents.length; ++i) {
|
||||
// key must be non-null String, value must be non-null
|
||||
String key = (String) contents[i][0];
|
||||
|
@ -538,7 +538,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
|
||||
cursor--;
|
||||
else {
|
||||
if (forgetMeNot == null)
|
||||
forgetMeNot = new ArrayDeque<E>();
|
||||
forgetMeNot = new ArrayDeque<>();
|
||||
forgetMeNot.add(moved);
|
||||
}
|
||||
} else if (lastRetElt != null) {
|
||||
|
@ -1011,7 +1011,7 @@ class Properties extends Hashtable<Object,Object> {
|
||||
* @since 1.6
|
||||
*/
|
||||
public Set<String> stringPropertyNames() {
|
||||
Hashtable<String, String> h = new Hashtable<String, String>();
|
||||
Hashtable<String, String> h = new Hashtable<>();
|
||||
enumerateStringProperties(h);
|
||||
return h.keySet();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* @return an iterator over the elements contained in this set
|
||||
*/
|
||||
public Iterator<E> iterator() {
|
||||
return new EnumSetIterator<E>();
|
||||
return new EnumSetIterator<>();
|
||||
}
|
||||
|
||||
private class EnumSetIterator<E extends Enum<E>> implements Iterator<E> {
|
||||
|
@ -191,7 +191,7 @@ public final class ServiceLoader<S>
|
||||
private ClassLoader loader;
|
||||
|
||||
// Cached providers, in instantiation order
|
||||
private LinkedHashMap<String,S> providers = new LinkedHashMap<String,S>();
|
||||
private LinkedHashMap<String,S> providers = new LinkedHashMap<>();
|
||||
|
||||
// The current lazy-lookup iterator
|
||||
private LazyIterator lookupIterator;
|
||||
@ -291,7 +291,7 @@ public final class ServiceLoader<S>
|
||||
{
|
||||
InputStream in = null;
|
||||
BufferedReader r = null;
|
||||
ArrayList<String> names = new ArrayList<String>();
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
try {
|
||||
in = u.openStream();
|
||||
r = new BufferedReader(new InputStreamReader(in, "utf-8"));
|
||||
@ -463,7 +463,7 @@ public final class ServiceLoader<S>
|
||||
public static <S> ServiceLoader<S> load(Class<S> service,
|
||||
ClassLoader loader)
|
||||
{
|
||||
return new ServiceLoader<S>(service, loader);
|
||||
return new ServiceLoader<>(service, loader);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -196,7 +196,7 @@ class TimSort<T> {
|
||||
* extending short natural runs to minRun elements, and merging runs
|
||||
* to maintain stack invariant.
|
||||
*/
|
||||
TimSort<T> ts = new TimSort<T>(a, c);
|
||||
TimSort<T> ts = new TimSort<>(a, c);
|
||||
int minRun = minRunLength(nRemaining);
|
||||
do {
|
||||
// Identify next run
|
||||
|
@ -533,7 +533,7 @@ public class TreeMap<K,V>
|
||||
// throw NullPointerException
|
||||
//
|
||||
// compare(key, key); // type check
|
||||
root = new Entry<K,V>(key, value, null);
|
||||
root = new Entry<>(key, value, null);
|
||||
size = 1;
|
||||
modCount++;
|
||||
return null;
|
||||
@ -569,7 +569,7 @@ public class TreeMap<K,V>
|
||||
return t.setValue(value);
|
||||
} while (t != null);
|
||||
}
|
||||
Entry<K,V> e = new Entry<K,V>(key, value, parent);
|
||||
Entry<K,V> e = new Entry<>(key, value, parent);
|
||||
if (cmp < 0)
|
||||
parent.left = e;
|
||||
else
|
||||
@ -1069,14 +1069,14 @@ public class TreeMap<K,V>
|
||||
}
|
||||
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive,
|
||||
E toElement, boolean toInclusive) {
|
||||
return new KeySet<E>(m.subMap(fromElement, fromInclusive,
|
||||
return new KeySet<>(m.subMap(fromElement, fromInclusive,
|
||||
toElement, toInclusive));
|
||||
}
|
||||
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
|
||||
return new KeySet<E>(m.headMap(toElement, inclusive));
|
||||
return new KeySet<>(m.headMap(toElement, inclusive));
|
||||
}
|
||||
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
|
||||
return new KeySet<E>(m.tailMap(fromElement, inclusive));
|
||||
return new KeySet<>(m.tailMap(fromElement, inclusive));
|
||||
}
|
||||
public SortedSet<E> subSet(E fromElement, E toElement) {
|
||||
return subSet(fromElement, true, toElement, false);
|
||||
@ -1205,7 +1205,7 @@ public class TreeMap<K,V>
|
||||
*/
|
||||
static <K,V> Map.Entry<K,V> exportEntry(TreeMap.Entry<K,V> e) {
|
||||
return (e == null) ? null :
|
||||
new AbstractMap.SimpleImmutableEntry<K,V>(e);
|
||||
new AbstractMap.SimpleImmutableEntry<>(e);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2406,7 +2406,7 @@ public class TreeMap<K,V>
|
||||
value = (defaultVal != null ? defaultVal : (V) str.readObject());
|
||||
}
|
||||
|
||||
Entry<K,V> middle = new Entry<K,V>(key, value, null);
|
||||
Entry<K,V> middle = new Entry<>(key, value, null);
|
||||
|
||||
// color nodes in non-full bottommost level red
|
||||
if (level == redLevel)
|
||||
|
@ -138,7 +138,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
* ordering} of the elements will be used.
|
||||
*/
|
||||
public TreeSet(Comparator<? super E> comparator) {
|
||||
this(new TreeMap<E,Object>(comparator));
|
||||
this(new TreeMap<>(comparator));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -195,7 +195,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
* @since 1.6
|
||||
*/
|
||||
public NavigableSet<E> descendingSet() {
|
||||
return new TreeSet<E>(m.descendingMap());
|
||||
return new TreeSet<>(m.descendingMap());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -322,7 +322,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
*/
|
||||
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive,
|
||||
E toElement, boolean toInclusive) {
|
||||
return new TreeSet<E>(m.subMap(fromElement, fromInclusive,
|
||||
return new TreeSet<>(m.subMap(fromElement, fromInclusive,
|
||||
toElement, toInclusive));
|
||||
}
|
||||
|
||||
@ -335,7 +335,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
* @since 1.6
|
||||
*/
|
||||
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
|
||||
return new TreeSet<E>(m.headMap(toElement, inclusive));
|
||||
return new TreeSet<>(m.headMap(toElement, inclusive));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -347,7 +347,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
* @since 1.6
|
||||
*/
|
||||
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
|
||||
return new TreeSet<E>(m.tailMap(fromElement, inclusive));
|
||||
return new TreeSet<>(m.tailMap(fromElement, inclusive));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -477,7 +477,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
clone.m = new TreeMap<E,Object>(m);
|
||||
clone.m = new TreeMap<>(m);
|
||||
return clone;
|
||||
}
|
||||
|
||||
@ -524,9 +524,9 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
// Create backing TreeMap
|
||||
TreeMap<E,Object> tm;
|
||||
if (c==null)
|
||||
tm = new TreeMap<E,Object>();
|
||||
tm = new TreeMap<>();
|
||||
else
|
||||
tm = new TreeMap<E,Object>(c);
|
||||
tm = new TreeMap<>(c);
|
||||
m = tm;
|
||||
|
||||
// Read in size
|
||||
|
@ -171,7 +171,7 @@ public class WeakHashMap<K,V>
|
||||
/**
|
||||
* Reference queue for cleared WeakEntries
|
||||
*/
|
||||
private final ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
|
||||
private final ReferenceQueue<Object> queue = new ReferenceQueue<>();
|
||||
|
||||
/**
|
||||
* The number of times this WeakHashMap has been structurally modified.
|
||||
@ -439,7 +439,7 @@ public class WeakHashMap<K,V>
|
||||
|
||||
modCount++;
|
||||
Entry<K,V> e = tab[i];
|
||||
tab[i] = new Entry<K,V>(k, value, queue, h, e);
|
||||
tab[i] = new Entry<>(k, value, queue, h, e);
|
||||
if (++size >= threshold)
|
||||
resize(tab.length * 2);
|
||||
return null;
|
||||
@ -955,10 +955,9 @@ public class WeakHashMap<K,V>
|
||||
}
|
||||
|
||||
private List<Map.Entry<K,V>> deepCopy() {
|
||||
List<Map.Entry<K,V>> list =
|
||||
new ArrayList<Map.Entry<K,V>>(size());
|
||||
List<Map.Entry<K,V>> list = new ArrayList<>(size());
|
||||
for (Map.Entry<K,V> e : this)
|
||||
list.add(new AbstractMap.SimpleEntry<K,V>(e));
|
||||
list.add(new AbstractMap.SimpleEntry<>(e));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class FileHandler extends StreamHandler {
|
||||
private FileOutputStream lockStream;
|
||||
private File files[];
|
||||
private static final int MAX_LOCKS = 100;
|
||||
private static java.util.HashMap<String, String> locks = new java.util.HashMap<String, String>();
|
||||
private static java.util.HashMap<String, String> locks = new java.util.HashMap<>();
|
||||
|
||||
// A metered stream is a subclass of OutputStream that
|
||||
// (a) forwards all its output to a target stream
|
||||
|
@ -59,7 +59,7 @@ import java.util.ResourceBundle;
|
||||
*/
|
||||
|
||||
public class Level implements java.io.Serializable {
|
||||
private static java.util.ArrayList<Level> known = new java.util.ArrayList<Level>();
|
||||
private static java.util.ArrayList<Level> known = new java.util.ArrayList<>();
|
||||
private static String defaultBundle = "sun.util.logging.resources.logging";
|
||||
|
||||
/**
|
||||
|
@ -156,8 +156,7 @@ public class LogManager {
|
||||
private final static Level defaultLevel = Level.INFO;
|
||||
|
||||
// Table of named Loggers that maps names to Loggers.
|
||||
private Hashtable<String,LoggerWeakRef> namedLoggers =
|
||||
new Hashtable<String,LoggerWeakRef>();
|
||||
private Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>();
|
||||
// Tree of named Loggers
|
||||
private LogNode root = new LogNode(null);
|
||||
private Logger rootLogger;
|
||||
@ -422,7 +421,7 @@ public class LogManager {
|
||||
// loggerRefQueue holds LoggerWeakRef objects for Logger objects
|
||||
// that have been GC'ed.
|
||||
private final ReferenceQueue<Logger> loggerRefQueue
|
||||
= new ReferenceQueue<Logger>();
|
||||
= new ReferenceQueue<>();
|
||||
|
||||
// Package-level inner class.
|
||||
// Helper class for managing WeakReferences to Logger objects.
|
||||
@ -672,7 +671,7 @@ public class LogManager {
|
||||
name = "";
|
||||
}
|
||||
if (node.children == null) {
|
||||
node.children = new HashMap<String,LogNode>();
|
||||
node.children = new HashMap<>();
|
||||
}
|
||||
LogNode child = node.children.get(head);
|
||||
if (child == null) {
|
||||
@ -856,7 +855,7 @@ public class LogManager {
|
||||
}
|
||||
hands = hands.trim();
|
||||
int ix = 0;
|
||||
Vector<String> result = new Vector<String>();
|
||||
Vector<String> result = new Vector<>();
|
||||
while (ix < hands.length()) {
|
||||
int end = ix;
|
||||
while (end < hands.length()) {
|
||||
|
@ -85,8 +85,7 @@ public class LogRecord implements java.io.Serializable {
|
||||
private static final AtomicInteger nextThreadId
|
||||
= new AtomicInteger(MIN_SEQUENTIAL_THREAD_ID);
|
||||
|
||||
private static final ThreadLocal<Integer> threadIds
|
||||
= new ThreadLocal<Integer>();
|
||||
private static final ThreadLocal<Integer> threadIds = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* @serial Logging message level
|
||||
|
@ -170,7 +170,7 @@ public class Logger {
|
||||
private LogManager manager;
|
||||
private String name;
|
||||
private final CopyOnWriteArrayList<Handler> handlers =
|
||||
new CopyOnWriteArrayList<Handler>();
|
||||
new CopyOnWriteArrayList<>();
|
||||
private String resourceBundleName;
|
||||
private volatile boolean useParentHandlers = true;
|
||||
private volatile Filter filter;
|
||||
@ -1420,13 +1420,13 @@ public class Logger {
|
||||
// Set our new parent.
|
||||
parent = newParent;
|
||||
if (parent.kids == null) {
|
||||
parent.kids = new ArrayList<LogManager.LoggerWeakRef>(2);
|
||||
parent.kids = new ArrayList<>(2);
|
||||
}
|
||||
if (ref == null) {
|
||||
// we didn't have a previous parent
|
||||
ref = manager.new LoggerWeakRef(this);
|
||||
}
|
||||
ref.setParentRef(new WeakReference<Logger>(parent));
|
||||
ref.setParentRef(new WeakReference<>(parent));
|
||||
parent.kids.add(ref);
|
||||
|
||||
// As a result of the reparenting, the effective level
|
||||
|
@ -56,7 +56,7 @@ class Logging implements LoggingMXBean {
|
||||
|
||||
public List<String> getLoggerNames() {
|
||||
Enumeration loggers = logManager.getLoggerNames();
|
||||
ArrayList<String> array = new ArrayList<String>();
|
||||
ArrayList<String> array = new ArrayList<>();
|
||||
|
||||
for (; loggers.hasMoreElements();) {
|
||||
array.add((String) loggers.nextElement());
|
||||
|
@ -155,8 +155,7 @@ public abstract class AbstractPreferences extends Preferences {
|
||||
* All known unremoved children of this node. (This "cache" is consulted
|
||||
* prior to calling childSpi() or getChild().
|
||||
*/
|
||||
private Map<String, AbstractPreferences> kidCache
|
||||
= new HashMap<String, AbstractPreferences>();
|
||||
private Map<String, AbstractPreferences> kidCache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* This field is used to keep track of whether or not this node has
|
||||
@ -713,7 +712,7 @@ public abstract class AbstractPreferences extends Preferences {
|
||||
if (removed)
|
||||
throw new IllegalStateException("Node has been removed.");
|
||||
|
||||
Set<String> s = new TreeSet<String>(kidCache.keySet());
|
||||
Set<String> s = new TreeSet<>(kidCache.keySet());
|
||||
for (String kid : childrenNamesSpi())
|
||||
s.add(kid);
|
||||
return s.toArray(EMPTY_STRING_ARRAY);
|
||||
@ -1442,8 +1441,7 @@ public abstract class AbstractPreferences extends Preferences {
|
||||
* event delivery from preference activity, greatly simplifying
|
||||
* locking and reducing opportunity for deadlock.
|
||||
*/
|
||||
private static final List<EventObject> eventQueue
|
||||
= new LinkedList<EventObject>();
|
||||
private static final List<EventObject> eventQueue = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* These two classes are used to distinguish NodeChangeEvents on
|
||||
|
@ -1068,7 +1068,7 @@ public final class Pattern
|
||||
public String[] split(CharSequence input, int limit) {
|
||||
int index = 0;
|
||||
boolean matchLimited = limit > 0;
|
||||
ArrayList<String> matchList = new ArrayList<String>();
|
||||
ArrayList<String> matchList = new ArrayList<>();
|
||||
Matcher m = matcher(input);
|
||||
|
||||
// Add segments before each match found
|
||||
@ -1566,7 +1566,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
||||
|
||||
Map<String, Integer> namedGroups() {
|
||||
if (namedGroups == null)
|
||||
namedGroups = new HashMap<String, Integer>(2);
|
||||
namedGroups = new HashMap<>(2);
|
||||
return namedGroups;
|
||||
}
|
||||
|
||||
@ -5309,7 +5309,7 @@ NEXT: while (i <= last) {
|
||||
}
|
||||
|
||||
private static final HashMap<String, CharPropertyFactory> map
|
||||
= new HashMap<String, CharPropertyFactory>();
|
||||
= new HashMap<>();
|
||||
|
||||
static {
|
||||
// Unicode character property aliases, defined in
|
||||
|
@ -543,7 +543,7 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
|
||||
if (streams.size() !=0) {
|
||||
Set<InputStream> copy = streams;
|
||||
streams = new HashSet<InputStream>();
|
||||
streams = new HashSet<>();
|
||||
for (InputStream is: copy)
|
||||
is.close();
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
}
|
||||
|
||||
private XEntry current;
|
||||
private Vector<XEntry> xentries = new Vector<XEntry>();
|
||||
private HashSet<String> names = new HashSet<String>();
|
||||
private Vector<XEntry> xentries = new Vector<>();
|
||||
private HashSet<String> names = new HashSet<>();
|
||||
private CRC32 crc = new CRC32();
|
||||
private long written = 0;
|
||||
private long locoff = 0;
|
||||
|
@ -120,7 +120,7 @@ public class Converters {
|
||||
|
||||
private static Class<?> cache(int type, Object encoding, Class<?> c) {
|
||||
SoftReference<Object[]>[] srs = classCache[type];
|
||||
srs[CACHE_SIZE - 1] = new SoftReference<Object[]>(new Object[] { c, encoding });
|
||||
srs[CACHE_SIZE - 1] = new SoftReference<>(new Object[] { c, encoding });
|
||||
moveToFront(srs, CACHE_SIZE - 1);
|
||||
return c;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class PlatformLogger {
|
||||
|
||||
// Table of known loggers. Maps names to PlatformLoggers.
|
||||
private static Map<String,WeakReference<PlatformLogger>> loggers =
|
||||
new HashMap<String,WeakReference<PlatformLogger>>();
|
||||
new HashMap<>();
|
||||
|
||||
/**
|
||||
* Returns a PlatformLogger of a given name.
|
||||
@ -126,7 +126,7 @@ public class PlatformLogger {
|
||||
}
|
||||
if (log == null) {
|
||||
log = new PlatformLogger(name);
|
||||
loggers.put(name, new WeakReference<PlatformLogger>(log));
|
||||
loggers.put(name, new WeakReference<>(log));
|
||||
}
|
||||
return log;
|
||||
}
|
||||
@ -488,7 +488,7 @@ public class PlatformLogger {
|
||||
*/
|
||||
static class JavaLogger extends LoggerProxy {
|
||||
private static final Map<Integer, Object> levelObjects =
|
||||
new HashMap<Integer, Object>();
|
||||
new HashMap<>();
|
||||
|
||||
static {
|
||||
if (LoggingSupport.isAvailable()) {
|
||||
|
@ -68,7 +68,7 @@ final class ProcessEnvironment
|
||||
// We cache the C environment. This means that subsequent calls
|
||||
// to putenv/setenv from C will not be visible from Java code.
|
||||
byte[][] environ = environ();
|
||||
theEnvironment = new HashMap<Variable,Value>(environ.length/2 + 3);
|
||||
theEnvironment = new HashMap<>(environ.length/2 + 3);
|
||||
// Read environment variables back to front,
|
||||
// so that earlier variables override later ones.
|
||||
for (int i = environ.length-1; i > 0; i-=2)
|
||||
|
@ -354,7 +354,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
* log against that map. The resulting map is then written back
|
||||
* to the disk.
|
||||
*/
|
||||
final List<Change> changeLog = new ArrayList<Change>();
|
||||
final List<Change> changeLog = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Represents a change to a preference.
|
||||
@ -507,7 +507,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
});
|
||||
if (newNode) {
|
||||
// These 2 things guarantee node will get wrtten at next flush/sync
|
||||
prefsCache = new TreeMap<String, String>();
|
||||
prefsCache = new TreeMap<>();
|
||||
nodeCreate = new NodeCreate();
|
||||
changeLog.add(nodeCreate);
|
||||
}
|
||||
@ -550,7 +550,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
loadCache();
|
||||
} catch(Exception e) {
|
||||
// assert lastSyncTime == 0;
|
||||
prefsCache = new TreeMap<String, String>();
|
||||
prefsCache = new TreeMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
@ -567,7 +567,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<Void>() {
|
||||
public Void run() throws BackingStoreException {
|
||||
Map<String, String> m = new TreeMap<String, String>();
|
||||
Map<String, String> m = new TreeMap<>();
|
||||
long newLastSyncTime = 0;
|
||||
try {
|
||||
newLastSyncTime = prefsFile.lastModified();
|
||||
@ -581,7 +581,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
prefsFile.renameTo( new File(
|
||||
prefsFile.getParentFile(),
|
||||
"IncorrectFormatPrefs.xml"));
|
||||
m = new TreeMap<String, String>();
|
||||
m = new TreeMap<>();
|
||||
} else if (e instanceof FileNotFoundException) {
|
||||
getLogger().warning("Prefs file removed in background "
|
||||
+ prefsFile.getPath());
|
||||
@ -646,7 +646,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<String[]>() {
|
||||
public String[] run() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
File[] dirContents = dir.listFiles();
|
||||
if (dirContents != null) {
|
||||
for (int i = 0; i < dirContents.length; i++)
|
||||
@ -794,7 +794,7 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
} else if (lastSyncTime != 0 && !dir.exists()) {
|
||||
// This node was removed in the background. Playback any changes
|
||||
// against a virgin (empty) Map.
|
||||
prefsCache = new TreeMap<String, String>();
|
||||
prefsCache = new TreeMap<>();
|
||||
replayChanges();
|
||||
}
|
||||
if (!changeLog.isEmpty()) {
|
||||
|
@ -250,8 +250,7 @@ final class ProcessEnvironment extends HashMap<String,String>
|
||||
envblock.substring(eql+1,end));
|
||||
}
|
||||
|
||||
theCaseInsensitiveEnvironment
|
||||
= new TreeMap<String,String>(nameComparator);
|
||||
theCaseInsensitiveEnvironment = new TreeMap<>(nameComparator);
|
||||
theCaseInsensitiveEnvironment.putAll(theEnvironment);
|
||||
}
|
||||
|
||||
@ -296,8 +295,7 @@ final class ProcessEnvironment extends HashMap<String,String>
|
||||
// Only for use by ProcessImpl.start()
|
||||
String toEnvironmentBlock() {
|
||||
// Sort Unicode-case-insensitively by name
|
||||
List<Map.Entry<String,String>> list
|
||||
= new ArrayList<Map.Entry<String,String>>(entrySet());
|
||||
List<Map.Entry<String,String>> list = new ArrayList<>(entrySet());
|
||||
Collections.sort(list, entryComparator);
|
||||
|
||||
StringBuilder sb = new StringBuilder(size()*30);
|
||||
|
@ -56,7 +56,7 @@ public class NPEProvoker implements java.io.Externalizable {
|
||||
public static void main(String[] args) {
|
||||
System.err.println("\n Regression test for bug 6541870\n");
|
||||
try {
|
||||
ArrayList<NPEProvoker> list = new ArrayList<NPEProvoker>();
|
||||
ArrayList<NPEProvoker> list = new ArrayList<>();
|
||||
list.add(new NPEProvoker());
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
|
@ -107,7 +107,7 @@ public class Inject implements RuntimeConstants {
|
||||
class IndexedInjector implements TrackerInjector {
|
||||
int counter = 0;
|
||||
int tracker;
|
||||
List<Info> infoList = new ArrayList<Info>();
|
||||
List<Info> infoList = new ArrayList<>();
|
||||
|
||||
public int stackSize(int currentSize) {
|
||||
return currentSize + 1;
|
||||
|
@ -50,7 +50,7 @@ class InjectBytecodes implements RuntimeConstants {
|
||||
private final Injector[] after = new Injector[256];
|
||||
private final String className;
|
||||
private final String methodName;
|
||||
private final Map<Integer,byte[]> snippets = new HashMap<Integer,byte[]>();
|
||||
private final Map<Integer,byte[]> snippets = new HashMap<>();
|
||||
|
||||
private int pos;
|
||||
private int newPos;
|
||||
|
@ -103,7 +103,7 @@ public class TestPlainArrayNotGeneric {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Set<Type> checking = new HashSet<Type>();
|
||||
private static final Set<Type> checking = new HashSet<>();
|
||||
|
||||
private static void check(Type t, String what) {
|
||||
if (t == null || !checking.add(t))
|
||||
|
@ -59,7 +59,7 @@ public class DistinctSeeds {
|
||||
}
|
||||
}
|
||||
final int threadCount = 2;
|
||||
List<RandomCollector> collectors = new ArrayList<RandomCollector>();
|
||||
List<RandomCollector> collectors = new ArrayList<>();
|
||||
List<Thread> threads = new ArrayList<Thread>();
|
||||
for (int i = 0; i < threadCount; i++) {
|
||||
RandomCollector r = new RandomCollector();
|
||||
|
@ -89,7 +89,7 @@ public class ClassLoaderLeakTest {
|
||||
|
||||
MyClassLoader appClassLoader = new MyClassLoader(urls, "test0");
|
||||
WeakReference<MyClassLoader> ref =
|
||||
new WeakReference<MyClassLoader>(appClassLoader);
|
||||
new WeakReference<>(appClassLoader);
|
||||
|
||||
|
||||
Thread appThread = new Thread(appsThreadGroup, launcher, "AppThread-0");
|
||||
|
Loading…
x
Reference in New Issue
Block a user