Author: bayard Date: Wed May 20 04:30:05 2009 New Revision: 776542 URL: http://svn.apache.org/viewvc?rev=776542&view=rev Log: Refactoring putAll to _putAll so the constructor can call the copying in code without running through a subclass' implementation of putAll. Reported in COLLECTIONS-317
Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java?rev=776542&r1=776541&r2=776542&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java Wed May 20 04:30:05 2009 @@ -161,7 +161,7 @@ */ protected AbstractHashedMap(Map map) { this(Math.max(2 * map.size(), DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR); - putAll(map); + _putAll(map); } /** @@ -295,6 +295,22 @@ * @throws NullPointerException if the map is null */ public void putAll(Map map) { + _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 overriden. + * + * @param map the map to add + * @throws NullPointerException if the map is null + */ + private void _putAll(Map map) { int mapSize = map.size(); if (mapSize == 0) { return;