Java Vector 二分查找2 Java Vector 二分查找 Java 获得链表的元素 Java Vector 二分查找2 import java.util.Vector; import java.util.Collections; public class Demo { public static void main(String[] args) { Vector vec = new Vector(); vec.add("X"); vec.add("M"); vec.add("D"); vec.add("A"); vec.add("O"); Collections.sort(vec); System.out.println("Sorted Vector: " + vec); int found = Collections.binarySearch(vec, "D"); System.out.println("Element found at : " + found); } } Java Vector 二分查找 Java 获得链表的元素