List of utility methods to do Collection Contain
boolean | containsOne(final Collection Return true , if sup contains at least one item from parts . for (E part : parts) { if (sup.contains(part)) return true; return false; |
boolean | containsPrefix(final Collection It returns whether at least a word contains the prefix. return words.stream().anyMatch(word -> word.startsWith(prefix));
|
boolean | containsPrefix(String str, Collection prefixes) if str starts with a prefix which is included in prefixes collection return true, otherwise return false. if (str != null && prefixes != null) { Iterator it = prefixes.iterator(); while (it.hasNext()) { String prefix = (String) it.next(); if (str.startsWith(prefix)) { return true; return false; |
boolean | containsSafe(Collection Type-safe wrapper for Collection#contains(Object) method. return collection.contains(value);
|
boolean | containsSame(Collection Checks if the given two Collection s contains the same elements in any order. if (first != null) { if (second != null) { if (first.size() == second.size()) { Collection<T> firstCopy = new LinkedList<T>(first); boolean same = true; Iterator<T> secondIter = second.iterator(); while (same && secondIter.hasNext()) { T secondNext = secondIter.next(); ... |
boolean | containsSameItems(Collection> col1, Collection> col2) contains Same Items if (col1 == col2) return true; if (col1 == null || col2 == null) return false; if (col1.size() != col2.size()) return false; List<Object> checkList = new ArrayList<Object>(col1); checkList.removeAll(col2); ... |
boolean | containsSameType(Object o, Collection collection) contains Same Type boolean result = false; for (Iterator iterator = collection.iterator(); iterator.hasNext();) { Object o1 = iterator.next(); if (o1.getClass() == o.getClass()) { result = true; break; return result; |
boolean | containsSome(Collection> source, Collection> target) Returns true if source contains at least one element in target .
if (source == target) return true; if ((source == null) != (target == null)) return false; return !Collections.disjoint(source, target); |
boolean | containsSome(final Collection contains Some for (E e : c2) if (c1.contains(e)) return true; return false; |
boolean | containsSome(HashSet contains Some for (T t : other) if (s1.contains(t)) return true; return false; |