Home  >  Article  >  Java  >  Detailed introduction to obtaining vectors

Detailed introduction to obtaining vectors

巴扎黑
巴扎黑Original
2017-06-15 13:56:491184browse

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

Detailed introduction to obtaining vectors

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

Detailed introduction to obtaining vectors

##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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn