Use forEach()

This commit is contained in:
Gary Gregory 2024-12-09 12:25:03 -05:00
parent 752aaa433b
commit 84cfe34d80
1 changed files with 1 additions and 3 deletions

View File

@ -559,9 +559,7 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
public <T> T[] toArray(final T[] arr) {
// special implementation to handle disappearing values
final List<V> list = new ArrayList<>(size());
for (final V value : this) {
list.add(value);
}
forEach(list::add);
return list.toArray(arr);
}
}