List of usage examples for java.util List contains
boolean contains(Object o);
From source file:Main.java
public static boolean supportGps(Context context) { final LocationManager mgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); if (mgr != null) { List<String> providers = mgr.getAllProviders(); return providers != null && providers.contains(LocationManager.GPS_PROVIDER); }/* ww w.j av a2s . c o m*/ return false; }
From source file:Main.java
public static <E> List<E> distinct(List<E> elements) { List<E> result = new ArrayList<>(); for (E element : elements) { if (!result.contains(element)) { result.add(element);//from w ww.j a va2 s .c o m } } return result; }
From source file:Main.java
static <E> List<E> distinct(List<E> elements) { //TODO Implement me List<E> value = new ArrayList<>(); for (E element : elements) { if (!value.contains(element)) { value.add(element);//from www . j a v a 2s. c o m } } return value; }
From source file:Main.java
public static boolean isCameraHdrSupported(Camera.Parameters params) { List<String> supported = params.getSupportedSceneModes(); return (supported != null) && supported.contains(SCENE_MODE_HDR); }
From source file:Main.java
public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b) { List<T> list = new ArrayList<T>(a); for (T element : b) { if (list.contains(element)) { list.remove(element);// w w w. ja v a 2 s . co m } } return list; }
From source file:Main.java
public static <T> boolean containsAny(List<? extends T> c1, List<? extends T> c2) { for (T element : c2) { if (c1.contains(element)) { return true; }/*from w w w . j av a2s .com*/ } return false; }
From source file:Main.java
public static <T> void addAllIgnoreDuplicates(List<T> collection, List<T> newEntities) { for (T newEntity : newEntities) { if (!collection.contains(newEntity)) collection.add(newEntity);/*from w ww. j a v a2 s . com*/ } }
From source file:Main.java
public static boolean deviceIsBlacklistedForOpenSLESUsage() { List<String> blackListedModels = Arrays.asList(BLACKLISTED_OPEN_SL_ES_MODELS); return blackListedModels.contains(Build.MODEL); }
From source file:Main.java
private static void addAnswer(List<Integer> answers, int count) { int val = randInt(1, 2 * 9); if (!answers.contains(val)) { answers.add(val); count--;// ww w.j a va 2s . c o m } if (count > 0) { addAnswer(answers, count); } }
From source file:Main.java
public static <T> List<T> uiqList(List<T> list) { if (list == null) { return list; }/*from ww w . j a va 2s. c o m*/ List<T> tList = new ArrayList<T>(list.size()); for (T t : list) { if (!tList.contains(t)) { tList.add(t); } } return tList; }