List of usage examples for java.util List contains
boolean contains(Object o);
From source file:Main.java
public static boolean contains(List<?> objects, Object object) { boolean contains = objects.contains(object); return contains; }
From source file:Main.java
public static <T> boolean containsAny(List<T> c1, List<? extends T> c2) { return c1.stream().anyMatch((e) -> c2.contains(e)); }
From source file:Main.java
public static <T> Boolean contains(T[] elements, T elementToFind) { List<T> elementsList = Arrays.asList(elements); return elementsList.contains(elementToFind); }
From source file:Main.java
public static boolean isInLatter(String s) { List<String> letters = Arrays.asList(LETTERS); return letters.contains(s); }
From source file:Main.java
/** * Safety add one element into collection, if collection contains specified object, it doesn't add it * * @param collection specified collection * @param object specified object/* w w w . j av a 2s .c om*/ * @return @see java.util.List#add */ public static boolean safeAdd(List collection, Object object) { return !collection.contains(object) && collection.add(object); }
From source file:edu.duke.cabig.c3pr.utils.web.C3PRWebUtils.java
public static boolean contains(List list, Object o) { return list.contains(o); }
From source file:Main.java
public static boolean addUniq(List<Object> list, Object object) { if (!list.contains(object)) return list.add(object); return false; }
From source file:Main.java
/** * Add the element to the list, if it is not already there. * To be used as a Set replacement, if the order of inserts is relevant. * @param <T>/* www. ja v a 2 s . c o m*/ * @param l1 * @param element * @return */ public static <T> List<T> addAllUnique(List<T> l1, T element) { if (!l1.contains(element)) { l1.add(element); } return l1; }
From source file:Main.java
/** * add distinct entry to list/*from w w w.java 2s . co m*/ * * @param <V> * @param sourceList * @param entry * @return if entry already exist in sourceList, return false, else add it and return true. */ public static <V> boolean addDistinctEntry(List<V> sourceList, V entry) { return (sourceList != null && !sourceList.contains(entry)) ? sourceList.add(entry) : false; }
From source file:Main.java
public static void setCameraFocusMode(String focusMode, Camera camera) { Camera.Parameters parameters = camera.getParameters(); List<String> sfm = parameters.getSupportedFocusModes(); if (sfm.contains(focusMode)) { parameters.setFocusMode(focusMode); }//ww w . j a va2 s . c o m camera.setParameters(parameters); }