File tree Expand file tree Collapse file tree
simple-common/src/main/java/top/cadecode/common/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,26 +12,25 @@ public class CollectUtil {
1212 /**
1313 * 判断数组是否为空
1414 *
15- * @param objects 数组
15+ * @param array 数组
1616 * @return boolean
1717 */
18- public static boolean isEmpty (Object [] objects ) {
19- return objects == null || objects .length == 0 ;
18+ public static < T > boolean isEmpty (T [] array ) {
19+ return array == null || array .length == 0 ;
2020 }
2121
2222 /**
2323 * 判断数组是否包含指定元素
2424 *
25- * @param objects 数组
26- * @param o 元素
25+ * @param array 数组
26+ * @param el 元素
2727 * @return boolean
2828 */
29- public static boolean contains (Object [] objects , Object o ) {
30- if (objects == null || objects . length == 0 ) {
29+ public static < T > boolean contains (T [] array , T el ) {
30+ if (isEmpty ( array ) ) {
3131 return false ;
3232 }
33- return Arrays .asList (objects ).contains (o );
33+ return Arrays .asList (array ).contains (el );
3434 }
3535
36-
3736}
You can’t perform that action at this time.
0 commit comments