List of utility methods to do List Contain
boolean | containsItems(List smallerList, List largerList) contains Items List tempList = new ArrayList(); for (Object o : largerList) tempList.add(o); for (Object check : smallerList) { if (tempList.contains(check)) tempList.remove(check); else return false; ... |
boolean | containsNonPositives(List contains Non Positives for (Long val : vals) { if (val <= 0L) { return true; return false; |
boolean | containsNull(List> list) Returns true if the given (non-null) List contains null as one of its values. for (Object o : list) { if (o == null) { return true; return false; |
boolean | containsNullElement(List source) Checks whether 'list' has any null element in it. if (source == null) return false; if (source.isEmpty()) return false; if (source.contains(null)) return true; return false; |
boolean | containsOneEqualElem(List first, List second) Test of a list contains one or more equal elements for (Object str : first) { if (second.contains(str)) return true; return false; |
boolean | containsOnly(List elements, Class clazz) contains Only if (elements.isEmpty()) return false; for (Iterator iter = elements.iterator(); iter.hasNext();) { if (!clazz.isAssignableFrom(iter.next().getClass())) return false; return true; |
boolean | containsOnlyEmptyValues(List Checks if all of the entries in a list of Strings is empty or null. if (list != null) { int emptyCount = 0; for (String value : list) { if (isEmpty(value)) emptyCount++; return (list.size() == emptyCount); return (false); |
boolean | containsOnlyNulls(List contains Only Nulls for (T t : list) if (t != null) return false; return true; |
boolean | containsOnlySequentialNumbers(List contains Only Sequential Numbers for (int i = 0; i < values.size() - 1; i++) { if (values.get(i) != values.get(i + 1) - 1) { return false; return true; |
boolean | containsOrIsEmpty(List contains Or Is Empty if (list == null || list.isEmpty() || list.contains(item)) return true; return false; |