svn commit: r585696 - /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r585696 - /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java

doogie-3
Author: doogie
Date: Wed Oct 17 13:57:09 2007
New Revision: 585696

URL: http://svn.apache.org/viewvc?rev=585696&view=rev
Log:
Add utility methods that create writable copies of maps, lists, and
sets.

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java?rev=585696&r1=585695&r2=585696&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java Wed Oct 17 13:57:09 2007
@@ -176,6 +176,24 @@
         return theBuf.toString();
     }
     
+    public static List makeListWritable(Collection col) {
+        List result = FastList.newInstance();
+        if (col != null) result.addAll(col);
+        return result;
+    }
+
+    public static Map makeMapWritable(Map map) {
+        Map result = FastMap.newInstance();
+        if (map != null) result.putAll(map);
+        return result;
+    }
+
+    public static Set makeSetWritable(Collection col) {
+        Set result = FastSet.newInstance();
+        if (col != null) result.addAll(col);
+        return result;
+    }
+
     /**
      * Sort a List of Maps by specified consistent keys.
      * @param listOfMaps List of Map objects to sort.