[Android] Set arrayToArrayList util method

Geoffrey Métais git at videolan.org
Wed Jul 5 18:39:46 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jul  5 18:38:25 2017 +0200| [3795695fdfd02a151b731f344ac0597262edf21c] | committer: Geoffrey Métais

Set arrayToArrayList util method

> https://code.videolan.org/videolan/vlc-android/commit/3795695fdfd02a151b731f344ac0597262edf21c
---

 vlc-android/src/org/videolan/vlc/util/Util.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 29d0f4c2d..ac520d92e 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -33,7 +33,9 @@ import java.io.Closeable;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 public class Util {
@@ -121,4 +123,10 @@ public class Util {
                 return true;
         return false;
     }
+
+    public static <T> ArrayList<T> arrayToArrayList(T[] array) {
+        ArrayList<T> list = new ArrayList<>(array.length);
+        Collections.addAll(list, array);
+        return list;
+    }
 }



More information about the Android mailing list