List of utility methods to do Collection Contain
boolean | contains(C collection, K key) Type-safe contains return collection.contains(key);
|
boolean | contains(Collection c, Object o, Comparator comparator) checks whether the object o is contained in the collection c if (comparator == null) { return c.contains(o); } else { for (Object o2 : c) { if (comparator.compare(o, o2) == 0) { return true; return false; |
boolean | contains(Collection coll, Object o, Comparator c) Answer whether or not coll contains Object o, but not based on equal(), but on compareTo()==0 boolean answer = false; for (Iterator i = coll.iterator(); i.hasNext() && !answer;) { answer = 0 == c.compare(o, i.next()); return answer; |
boolean | contains(Collection collection, Object object) contains return collection.contains(object);
|
boolean | contains(Collection objects, Object o) contains if (objects == null || o == null) return false; else return objects.contains(o); |
boolean | contains(Collection searchIn, Object[] find) contains for (Iterator iterator = searchIn.iterator(); iterator.hasNext();) { Object[] objects = (Object[]) iterator.next(); if (arraysEquals(objects, find)) { return true; return false; |
boolean | contains(Collection stringCollection, String value) Determine if a String is contained in a String Collection if (stringCollection == null || value == null) return false; if (value.length() == 0) return false; for (Iterator i = stringCollection.iterator(); i.hasNext();) { Object o = i.next(); if (!(o instanceof String)) continue; ... |
boolean | contains(Collection collection, A value) Checks if an input collection contains a given value. if (collection.isEmpty()) return false; for (A item : collection) if (item == value) return true; return false; |
boolean | contains(Collectioncontains(Collection, object): checks whether the object is in object collection (create empty collection if the array is null)
if (objectArray == null) { objectArray = new ArrayList<Object>(); return objectArray.contains(element); |
boolean | contains(Collection Test if given string contains any element in the container. boolean bReturn = false; if ((container != null) && (!container.isEmpty())) { for (Iterator<String> itrElements = container.iterator(); (itrElements.hasNext() && (!bReturn));) { if (strSearch.contains(itrElements.next())) { bReturn = true; return bReturn; |