检查此数组是否包含对象。
//来自 N o w J a v a . c o m - 时 代 Java //package com.nowjava; public class Main { /** * Checks to see if this array contains an object. This method uses the {@link Object#equals(Object)} function and the * {@link Object#hashCode()} function to compare * @param a The array to check * @param obj The object that should be inside the array * @param <T> The type of this array * @return True if the item is inside the array, false otherwise */ public static <T> boolean contains(T[] a, T obj) { for (T item : a) { if (item.equals(obj) || item.