class GenericContains {
    public static <T> boolean contains(T [] arr, T x) {
	for (int i = 0; i < arr.length; i++) {
	    if (x.equals( arr[i]) ) return true;
        }
        return false;
    }

    public static void main( String [] args) {

	Integer [] arr1 = { new Integer(7), new Integer(13), new Integer(17), new Integer(12)};
        String [] arr2 = { "Jack", "Jill", "Pail", "Water" };
        System.out.println( contains( arr1, new Integer(12)));
        System.out.println( contains( arr1, new Integer(15)));
        System.out.println( contains( arr2, "Crown"));
        System.out.println( contains( arr2, "Pail"));
    }
}