检查数组中的项的泛型方法
//package com.nowjava; /**来自 n o w j a v a . c o m**/ public class Main { public static <T> boolean inArray(T[] array, T other) { for (Object object : array) { if (object.equals(other)) { return true; } } return false; } }
//package com.nowjava; /**来自 n o w j a v a . c o m**/ public class Main { public static <T> boolean inArray(T[] array, T other) { for (Object object : array) { if (object.equals(other)) { return true; } } return false; } }