From f0e4253195684758fad8e5d4411678a60131d782 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 14 Jul 2024 12:09:23 -0400 Subject: [PATCH] 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 eb5dbfde11..8994c36d70 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 @@ protected AbstractHashedMap(final int initialCapacity, final float loadFactor, f */ protected AbstractHashedMap(final Map 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. - *

- * This implementation iterates around the specified map and - * uses {@link #put(Object, Object)}. - *

- * 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 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 entry: map.entrySet()) { - put(entry.getKey(), entry.getValue()); - } + putAll(map); } /** @@ -1280,7 +1256,15 @@ public V put(final K key, final V value) { */ @Override public void putAll(final Map 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 entry: map.entrySet()) { + put(entry.getKey(), entry.getValue()); + } } /**