Java examples for Collection Framework:Vector
Find maximum element of Vector
import java.util.Vector; import java.util.Collections; public class Main { public static void main(String[] args) { Vector v = new Vector(); /*from w w w . jav a 2s. c om*/ v.add(new Double("3.1")); v.add(new Double("5.1")); v.add(new Double("2.1")); v.add(new Double("7.1")); v.add(new Double("3.1")); Object obj = Collections.max(v); System.out.println("Maximum Element of Java Vector is : " + obj); } }