[main] Potential fix for incorrect hasNext in ref
This commit is contained in:
parent
87bcac302c
commit
9e0711efc7
|
@ -21,7 +21,7 @@ public class WeakSet<E> extends AbstractSet<E> {
|
|||
synchronized (WeakSet.this) {
|
||||
if (delegate.hasNext()) {
|
||||
next = unwrap(delegate.next());
|
||||
return true;
|
||||
return next != null || hasNext();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -190,7 +190,9 @@ public class WeakValueMap<K, V> implements Map<K, V> {
|
|||
synchronized (WeakValueMap.this) {
|
||||
if (delegate.hasNext()) {
|
||||
Entry<K, WeakValue<K, V>> ent = delegate.next();
|
||||
next = new DelegateEntry(ent, unwrap(ent.getValue()));
|
||||
V value = unwrap(ent.getValue());
|
||||
if (value == null) return hasNext();
|
||||
next = new DelegateEntry(ent, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue