Commits

Anonymous committed db6d035

Finetuning.

Comments (0)

Files changed (3)

src/META-INF/upgrade/Bundle.properties

+DN_UseArrays=Use Collection.addAll

src/META-INF/upgrade/array-to-collection.hint

+for ($type $var : $arr) {
+     $coll.add($var);
+} :: $arr instanceof java.lang.Object[] && $coll instanceof java.util.Collection
+=>
+$coll.addAll(java.util.Arrays.asList($arr));
+;;

src/demo/ArrayToCollection.java

+package demo;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class ArrayToCollection {
+    public static Collection<String> join(String[] arr1, String[] arr2) {
+        List<String> result = new ArrayList<String>(arr1.length + arr2.length);
+        
+        for (String a1 : arr1) {
+            result.add(a1);
+        }
+        
+        for (String a2 : arr2) {
+            result.add(a2);
+        }
+        
+        return result;
+    }
+}