Author: adrianc
Date: Mon Jun 2 11:40:05 2008
New Revision: 662511
URL:
http://svn.apache.org/viewvc?rev=662511&view=revLog:
Small improvement to the MapStack class. The create(Map baseMap) method will create a standalone stack if baseMap is a MapStack. This will help reduce the code needed in calling methods.
Modified:
ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/collections/MapStack.java
Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/collections/MapStack.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/collections/MapStack.java?rev=662511&r1=662510&r2=662511&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/collections/MapStack.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/collections/MapStack.java Mon Jun 2 11:40:05 2008
@@ -20,7 +20,6 @@
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -61,9 +60,14 @@
return newValue;
}
+ @SuppressWarnings("unchecked")
public static <K> MapStack<K> create(Map<K, Object> baseMap) {
MapStack<K> newValue = MapStack.getMapStack();
- newValue.stackList.add(0, baseMap);
+ if (baseMap instanceof MapStack) {
+ newValue.stackList.addAll(((MapStack) baseMap).stackList);
+ } else {
+ newValue.stackList.add(0, baseMap);
+ }
return newValue;
}