jodd-core/src/main/java/jodd/util/Util.java
public static boolean containsElement(final Object obj, final Object element) {
		if (obj == null) {
			return false;
		}
		if (obj instanceof String) {
			if (element == null) {
				return false;
			}
			return ((String) obj).contains(element.toString());
		}
		if (obj instanceof Collection) {
			return ((Collection) obj).contains(element);
		}
		if (obj instanceof Map) {
			return ((Map) obj).values().contains(element);
		}

		if (obj instanceof Iterator) {
			Iterator iter = (Iterator) obj;
			while (iter.hasNext()) {
				Object o = iter.next();
				if (equals(o, element)) {
					return true;
				}
			}
			return false;
		}
		if (obj instanceof Enumeration) {
			Enumeration enumeration = (Enumeration) obj;
			while (enumeration.hasMoreElements()) {
				Object o = enumeration.nextElement();
				if (equals(o, element)) {
					return true;
				}
			}
			return false;
		}
		if (obj.getClass().isArray()) {
			int len = Array.getLength(obj);
			for (int i = 0; i < len; i++) {
				Object o = Array.get(obj, i);
				if (equals(o, element)) {
					return true;
				}
			}
		}
		return false;
	}
public static boolean containsElement(final Object obj, final Object element) {
		if (obj == null) {
			return false;
		}
		if (obj instanceof String) {
			if (element == null) {
				return false;
			}
			return ((String) obj).contains(element.toString());
		}
		if (obj instanceof Collection) {
			return ((Collection) obj).contains(element);
		}
		if (obj instanceof Map) {
			return ((Map) obj).values().contains(element);
		}

		if (obj instanceof Iterator) {
			Iterator iter = (Iterator) obj;
			while (iter.hasNext()) {
				Object o = iter.next();
				if (equals(o, element)) {
					return true;
				}
			}
			return false;
		}
		if (obj instanceof Enumeration) {
			Enumeration enumeration = (Enumeration) obj;
			while (enumeration.hasMoreElements()) {
				Object o = enumeration.nextElement();
				if (equals(o, element)) {
					return true;
				}
			}
			return false;
		}
		if (obj.getClass().isArray()) {
			int len = Array.getLength(obj);
			for (int i = 0; i < len; i++) {
				Object o = Array.get(obj, i);
				if (equals(o, element)) {
					return true;
				}
			}
		}
		return false;
	}
public static boolean containsElement ( final Object obj , final Object element ) { if ( obj == null ) { return false ; } if ( obj instanceof String ) { if ( element == null ) { return false ; } return ( ( String ) obj ) . contains ( element . toString ( ) ) ; } if ( obj instanceof Collection ) { return ( ( Collection ) obj ) . contains ( element ) ; } if ( obj instanceof Map ) { return ( ( Map ) obj ) . values ( ) . contains ( element ) ; } if ( obj instanceof Iterator ) { Iterator iter = ( Iterator ) obj ; while ( iter . hasNext ( ) ) { Object o = iter . next ( ) ; if ( equals ( o , element ) ) { return true ; } } return false ; } if ( obj instanceof Enumeration ) { Enumeration enumeration = ( Enumeration ) obj ; while ( enumeration . hasMoreElements ( ) ) { Object o = enumeration . nextElement ( ) ; if ( equals ( o , element ) ) { return true ; } } return false ; } if ( obj . getClass ( ) . isArray ( ) ) { int len = Array . getLength ( obj ) ; for ( int i = 0 ; i < len ; i ++ ) { Object o = Array . get ( obj , i ) ; if ( equals ( o , element ) ) { return true ; } } } return false ; }
Returns <code>true</code> if first argument contains provided element.
It works for strings, collections, maps and arrays.
s
Returns <code > true< / code > if first argument contains provided element . It works for strings collections maps and arrays . s