[Android] arrayContains util method
Geoffrey Métais
git at videolan.org
Thu Feb 23 17:31:43 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 23 17:29:15 2017 +0100| [4f16e6f59033d236049b510134b8a071cc1670c9] | committer: Geoffrey Métais
arrayContains util method
Util method to check if an array contains an object
> https://code.videolan.org/videolan/vlc-android/commit/4f16e6f59033d236049b510134b8a071cc1670c9
---
vlc-android/src/org/videolan/vlc/util/Util.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 482d75b..39f7646 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -25,6 +25,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.support.annotation.Nullable;
+import org.videolan.medialibrary.Tools;
import org.videolan.vlc.VLCApplication;
import java.io.BufferedReader;
@@ -102,4 +103,13 @@ public class Util {
destArray[i] = array[i-offset];
}
}
+
+ public static boolean arrayContains(Object[] array, Object item) {
+ if (Tools.isArrayEmpty(array))
+ return false;
+ for (Object obj : array)
+ if (obj.equals(item))
+ return true;
+ return false;
+ }
}
More information about the Android
mailing list