[Android] Util method to test if a list is null or empty
Geoffrey Métais
git at videolan.org
Tue Jun 14 15:29:29 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jun 14 15:16:37 2016 +0200| [26086ee0e0098f525abc2599cd9c1cd8c16a8fa3] | committer: Geoffrey Métais
Util method to test if a list is null or empty
> https://code.videolan.org/videolan/vlc-android/commit/26086ee0e0098f525abc2599cd9c1cd8c16a8fa3
---
vlc-android/src/org/videolan/vlc/util/Util.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 13f3541..b1679b2 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -25,9 +25,9 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.support.annotation.Nullable;
import org.videolan.libvlc.util.AndroidUtil;
-import org.videolan.libvlc.util.MediaBrowser;
import org.videolan.vlc.VLCApplication;
import java.io.BufferedReader;
@@ -35,6 +35,7 @@ import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.util.AbstractCollection;
import java.util.List;
public class Util {
@@ -83,6 +84,10 @@ public class Util {
return false;
}
+ public static boolean isListEmpty(@Nullable AbstractCollection collection) {
+ return collection == null || collection.isEmpty();
+ }
+
public static boolean isCallable(Intent intent) {
List<ResolveInfo> list = VLCApplication.getAppContext().getPackageManager().queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
More information about the Android
mailing list