Java:如何判斷一個數組中是否包含某個元素

Java:如何判斷一個數組中是否包含某個元素 方法1、使用List public static boolean useList(String[] arr, String targetValue) { return Arrays.asList(arr).contains(targetValue); } 方法2、使用Set public static boolean useSet(String
相關文章
相關標籤/搜索