Click here to watch in Youtube :
https://www.youtube.com/watch?v=8A3y_8aDPIA&list=UUhwKlOVR041tngjerWxVccw
CollectionsExample.java
Output
https://www.youtube.com/watch?v=8A3y_8aDPIA&list=UUhwKlOVR041tngjerWxVccw
CollectionsExample.java
import java.util.ArrayList; import java.util.Collections; /* * Example of * max(Collection<? extends T> coll) method */ public class CollectionsExample { public static void main(String[] args) { ArrayList<Integer> arrayList = new ArrayList<Integer>(); arrayList.add(2000); arrayList.add(3000); arrayList.add(4000); arrayList.add(1000); System.out.println("arrayList : " + arrayList + "\n"); /* * Returns the maximum element of the given collection, according to the * natural ordering of its elements. All elements in the collection must * implement the Comparable interface. */ Integer maxElement = Collections.max(arrayList); System.out.println("maxElement : " + maxElement); } }
arrayList : [2000, 3000, 4000, 1000] maxElement : 4000
https://sites.google.com/site/javaee4321/java-collections/CollectionsDemoMaxApp.zip?attredirects=0&d=1
See also:
azure online courses
ReplyDeletejava online courses
salesforce online courses
hadoop online courses
Data Science online courses
linux online courses
etl testing online courses
web methods online courses
business analyst online course
oracle adf online course
oracle rac online course