Java 配列の検索
事前にsort しておけば、Arrays.binarySearchで検索できる
String[] strsr = {"a", "b", "c"}; String search = "c"; if ( Arrays.binarySearch(strsr, search) >= 1){ System.out.println("c is exists!"); } else { System.out.println("c is not exists"); }
事前にsort しておけば、Arrays.binarySearchで検索できる
String[] strsr = {"a", "b", "c"}; String search = "c"; if ( Arrays.binarySearch(strsr, search) >= 1){ System.out.println("c is exists!"); } else { System.out.println("c is not exists"); }