This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push:
new f0e425319 Remove private method
f0e425319 is described below
commit f0e4253195684758fad8e5d4411678a60131d782
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jul 14 12:09:23 2024 -0400
Remove private method
---
.../collections4/map/AbstractHashedMap.java | 36 ++++++----------------
1 file changed, 10 insertions(+), 26 deletions(-)
diff --git
a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
index eb5dbfde1..8994c36d7 100644
--- a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
+++ b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java
@@ -585,31 +585,7 @@ public class AbstractHashedMap<K, V> extends
AbstractMap<K, V> implements Iterab
*/
protected AbstractHashedMap(final Map<? extends K, ? extends V> map) {
this(Math.max(2 * map.size(), DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR);
- _putAll(map);
- }
-
- /**
- * Puts all the values from the specified map into this map.
- * <p>
- * This implementation iterates around the specified map and
- * uses {@link #put(Object, Object)}.
- * <p>
- * It is private to allow the constructor to still call it
- * even when putAll is overridden.
- *
- * @param map the map to add
- * @throws NullPointerException if the map is null
- */
- private void _putAll(final Map<? extends K, ? extends V> map) {
- final int mapSize = map.size();
- if (mapSize == 0) {
- return;
- }
- final int newSize = (int) ((size + mapSize) / loadFactor + 1);
- ensureCapacity(calculateNewCapacity(newSize));
- for (final Map.Entry<? extends K, ? extends V> entry: map.entrySet()) {
- put(entry.getKey(), entry.getValue());
- }
+ putAll(map);
}
/**
@@ -1280,7 +1256,15 @@ public class AbstractHashedMap<K, V> extends
AbstractMap<K, V> implements Iterab
*/
@Override
public void putAll(final Map<? extends K, ? extends V> map) {
- _putAll(map);
+ final int mapSize = map.size();
+ if (mapSize == 0) {
+ return;
+ }
+ final int newSize = (int) ((size + mapSize) / loadFactor + 1);
+ ensureCapacity(calculateNewCapacity(newSize));
+ for (final Map.Entry<? extends K, ? extends V> entry: map.entrySet()) {
+ put(entry.getKey(), entry.getValue());
+ }
}
/**