Home >Java >javaTutorial >Detailed introduction to obtaining vectors
The following example demonstrates using the v.add() method of the Vector class and Collections.max() of the Collection class to obtain the maximum element of the vector: /* author by w3cschool.cc Main.java */import java.util.Collections;import java.util.Vector;public class Main { public static void main(String[] args) { Vector v = new V
1. Java Example - Get the maximum element of the vector
Introduction: The following example demonstrates using the v.add() method of the Vector class and Collections.max() of the Collection class to obtain the maximum element of the vector:
2. Java Example - Get the index value of a vector element
##Introduction: The following example demonstrates To use the sort() method of the Collections class to sort the vector and use the binarySearch() method to obtain the index value of the vector element:
[Related Q&A recommendations]:
The above is the detailed content of Detailed introduction to obtaining vectors. For more information, please follow other related articles on the PHP Chinese website!