You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2007/10/17 22:57:09 UTC

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

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.