svn commit: r588206 - /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: r588206 - /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilMisc.java

jonesde
Author: jonesde
Date: Thu Oct 25 05:04:23 2007
New Revision: 588206

URL: http://svn.apache.org/viewvc?rev=588206&view=rev
Log:
A handy little method to facilitate some GenericDelegator new/enhanced methods that are now using Set instead of Collection as they should be

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=588206&r1=588205&r2=588206&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 Thu Oct 25 05:04:23 2007
@@ -267,6 +267,19 @@
         return lst.remove(0);
     }
     
+    public static <T> Set<T> collectionToSet(Collection<T> c) {
+        if (c == null) return null;
+        Set theSet = null;
+        if (c instanceof Set) {
+            theSet = (Set) c;
+        } else {
+            theSet = FastSet.newInstance();
+            c.remove(null);
+            theSet.addAll(c);
+        }
+        return theSet;
+    }
+    
     /**
      * Create a Set from passed objX parameters
      * @return The resulting Set