8035284: Remove redundant null initialization
Reviewed-by: lancea, martin, chegar, shade
This commit is contained in:
parent
9e71840a87
commit
c78cb9b1c5
@ -305,8 +305,8 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* appropriate view the first time this view is requested. The views are
|
||||
* stateless, so there's no reason to create more than one of each.
|
||||
*/
|
||||
transient volatile Set<K> keySet = null;
|
||||
transient volatile Collection<V> values = null;
|
||||
transient volatile Set<K> keySet;
|
||||
transient volatile Collection<V> values;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -1466,9 +1466,9 @@ public class Collections {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private transient Set<K> keySet = null;
|
||||
private transient Set<Map.Entry<K,V>> entrySet = null;
|
||||
private transient Collection<V> values = null;
|
||||
private transient Set<K> keySet;
|
||||
private transient Set<Map.Entry<K,V>> entrySet;
|
||||
private transient Collection<V> values;
|
||||
|
||||
public Set<K> keySet() {
|
||||
if (keySet==null)
|
||||
@ -2597,9 +2597,9 @@ public class Collections {
|
||||
synchronized (mutex) {m.clear();}
|
||||
}
|
||||
|
||||
private transient Set<K> keySet = null;
|
||||
private transient Set<Map.Entry<K,V>> entrySet = null;
|
||||
private transient Collection<V> values = null;
|
||||
private transient Set<K> keySet;
|
||||
private transient Set<Map.Entry<K,V>> entrySet;
|
||||
private transient Collection<V> values;
|
||||
|
||||
public Set<K> keySet() {
|
||||
synchronized (mutex) {
|
||||
@ -3082,7 +3082,7 @@ public class Collections {
|
||||
return c.add(e);
|
||||
}
|
||||
|
||||
private E[] zeroLengthElementArray = null; // Lazily initialized
|
||||
private E[] zeroLengthElementArray; // Lazily initialized
|
||||
|
||||
private E[] zeroLengthElementArray() {
|
||||
return zeroLengthElementArray != null ? zeroLengthElementArray :
|
||||
@ -3643,7 +3643,7 @@ public class Collections {
|
||||
m.put(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
private transient Set<Map.Entry<K,V>> entrySet = null;
|
||||
private transient Set<Map.Entry<K,V>> entrySet;
|
||||
|
||||
public Set<Map.Entry<K,V>> entrySet() {
|
||||
if (entrySet==null)
|
||||
@ -4877,9 +4877,9 @@ public class Collections {
|
||||
public boolean containsValue(Object value) {return eq(value, v);}
|
||||
public V get(Object key) {return (eq(key, k) ? v : null);}
|
||||
|
||||
private transient Set<K> keySet = null;
|
||||
private transient Set<Map.Entry<K,V>> entrySet = null;
|
||||
private transient Collection<V> values = null;
|
||||
private transient Set<K> keySet;
|
||||
private transient Set<Map.Entry<K,V>> entrySet;
|
||||
private transient Collection<V> values;
|
||||
|
||||
public Set<K> keySet() {
|
||||
if (keySet==null)
|
||||
|
@ -367,7 +367,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
* view the first time this view is requested. The view is stateless,
|
||||
* so there's no reason to create more than one.
|
||||
*/
|
||||
private transient Set<Map.Entry<K,V>> entrySet = null;
|
||||
private transient Set<Map.Entry<K,V>> entrySet;
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} view of the keys contained in this map.
|
||||
@ -562,7 +562,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
}
|
||||
|
||||
private class EntryIterator extends EnumMapIterator<Map.Entry<K,V>> {
|
||||
private Entry lastReturnedEntry = null;
|
||||
private Entry lastReturnedEntry;
|
||||
|
||||
public Map.Entry<K,V> next() {
|
||||
if (!hasNext())
|
||||
|
@ -617,9 +617,9 @@ public class Hashtable<K,V>
|
||||
* appropriate view the first time this view is requested. The views are
|
||||
* stateless, so there's no reason to create more than one of each.
|
||||
*/
|
||||
private transient volatile Set<K> keySet = null;
|
||||
private transient volatile Set<Map.Entry<K,V>> entrySet = null;
|
||||
private transient volatile Collection<V> values = null;
|
||||
private transient volatile Set<K> keySet;
|
||||
private transient volatile Set<Map.Entry<K,V>> entrySet;
|
||||
private transient volatile Collection<V> values;
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} view of the keys contained in this map.
|
||||
@ -1300,8 +1300,8 @@ public class Hashtable<K,V>
|
||||
private class Enumerator<T> implements Enumeration<T>, Iterator<T> {
|
||||
Entry<?,?>[] table = Hashtable.this.table;
|
||||
int index = table.length;
|
||||
Entry<?,?> entry = null;
|
||||
Entry<?,?> lastReturned = null;
|
||||
Entry<?,?> entry;
|
||||
Entry<?,?> lastReturned;
|
||||
int type;
|
||||
|
||||
/**
|
||||
|
@ -842,7 +842,7 @@ public class IdentityHashMap<K,V>
|
||||
private class EntryIterator
|
||||
extends IdentityHashMapIterator<Map.Entry<K,V>>
|
||||
{
|
||||
private Entry lastReturnedEntry = null;
|
||||
private Entry lastReturnedEntry;
|
||||
|
||||
public Map.Entry<K,V> next() {
|
||||
lastReturnedEntry = new Entry(nextIndex());
|
||||
@ -928,7 +928,7 @@ public class IdentityHashMap<K,V>
|
||||
* view the first time this view is requested. The view is stateless,
|
||||
* so there's no reason to create more than one.
|
||||
*/
|
||||
private transient Set<Map.Entry<K,V>> entrySet = null;
|
||||
private transient Set<Map.Entry<K,V>> entrySet;
|
||||
|
||||
/**
|
||||
* Returns an identity-based set view of the keys contained in this map.
|
||||
|
@ -869,7 +869,7 @@ public class LinkedList<E>
|
||||
}
|
||||
|
||||
private class ListItr implements ListIterator<E> {
|
||||
private Node<E> lastReturned = null;
|
||||
private Node<E> lastReturned;
|
||||
private Node<E> next;
|
||||
private int nextIndex;
|
||||
private int expectedModCount = modCount;
|
||||
|
@ -120,7 +120,7 @@ public class TreeMap<K,V>
|
||||
*/
|
||||
private final Comparator<? super K> comparator;
|
||||
|
||||
private transient Entry<K,V> root = null;
|
||||
private transient Entry<K,V> root;
|
||||
|
||||
/**
|
||||
* The number of entries in the tree
|
||||
@ -781,9 +781,9 @@ public class TreeMap<K,V>
|
||||
* the first time this view is requested. Views are stateless, so
|
||||
* there's no reason to create more than one.
|
||||
*/
|
||||
private transient EntrySet entrySet = null;
|
||||
private transient KeySet<K> navigableKeySet = null;
|
||||
private transient NavigableMap<K,V> descendingMap = null;
|
||||
private transient EntrySet entrySet;
|
||||
private transient KeySet<K> navigableKeySet;
|
||||
private transient NavigableMap<K,V> descendingMap;
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} view of the keys contained in this map.
|
||||
@ -1583,9 +1583,9 @@ public class TreeMap<K,V>
|
||||
}
|
||||
|
||||
// Views
|
||||
transient NavigableMap<K,V> descendingMapView = null;
|
||||
transient EntrySetView entrySetView = null;
|
||||
transient KeySet<K> navigableKeySetView = null;
|
||||
transient NavigableMap<K,V> descendingMapView;
|
||||
transient EntrySetView entrySetView;
|
||||
transient KeySet<K> navigableKeySetView;
|
||||
|
||||
public final NavigableSet<K> navigableKeySet() {
|
||||
KeySet<K> nksv = navigableKeySetView;
|
||||
@ -2046,8 +2046,8 @@ public class TreeMap<K,V>
|
||||
static final class Entry<K,V> implements Map.Entry<K,V> {
|
||||
K key;
|
||||
V value;
|
||||
Entry<K,V> left = null;
|
||||
Entry<K,V> right = null;
|
||||
Entry<K,V> left;
|
||||
Entry<K,V> right;
|
||||
Entry<K,V> parent;
|
||||
boolean color = BLACK;
|
||||
|
||||
|
@ -759,21 +759,21 @@ public class WeakHashMap<K,V>
|
||||
|
||||
private abstract class HashIterator<T> implements Iterator<T> {
|
||||
private int index;
|
||||
private Entry<K,V> entry = null;
|
||||
private Entry<K,V> lastReturned = null;
|
||||
private Entry<K,V> entry;
|
||||
private Entry<K,V> lastReturned;
|
||||
private int expectedModCount = modCount;
|
||||
|
||||
/**
|
||||
* Strong reference needed to avoid disappearance of key
|
||||
* between hasNext and next
|
||||
*/
|
||||
private Object nextKey = null;
|
||||
private Object nextKey;
|
||||
|
||||
/**
|
||||
* Strong reference needed to avoid disappearance of key
|
||||
* between nextEntry() and any use of the entry
|
||||
*/
|
||||
private Object currentKey = null;
|
||||
private Object currentKey;
|
||||
|
||||
HashIterator() {
|
||||
index = isEmpty() ? 0 : table.length;
|
||||
@ -848,7 +848,7 @@ public class WeakHashMap<K,V>
|
||||
|
||||
// Views
|
||||
|
||||
private transient Set<Map.Entry<K,V>> entrySet = null;
|
||||
private transient Set<Map.Entry<K,V>> entrySet;
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} view of the keys contained in this map.
|
||||
|
Loading…
x
Reference in New Issue
Block a user