检查数组中是否包含元素的泛型方法
//package com.nowjava; public class Main {/**N o w J a v a . c o m**/ public static <T> boolean contains(T[] array, T value) { final Class<?> componetType = array.getClass().getComponentType(); boolean isPrimitive = false; if (null != componetType) { isPrimitive = componetType.isPrimitive(); } for (T t : array) { if (t == value) { return true; } else if (false == isPrimitive && null != value && value.equals(t)) {