70 likes | 93 Views
https://firstcode.school/collections-class-in-java/
E N D
COLLECTIONS CLASS IN JAVA Presentation by Firstcode
WHAT IS A JAVA COLLECTIONS CLASS? The Java collection class contains static methods that work on or return collections. Here are a couple of important points about Collections: It supports polymorphic algorithms that operate on collections. It throws a NullPointerException when the given collections or class objects are null.
FIELDS IN JAVA COLLECTIONS CLASS: S.no Modifier & Type Methods Description It adds all the mentioned elements to the specified collection. 1 static <T> boolean addAll() It returns a Deque view as a Last-In-first-Out Queue. 2 static <T> Queue<T> asLifoQueue() It searches for a particular object from the list and returns its position in a sorted list. 3 static <T> int binarySearch() It returns a dynamically typesafe view of the particular collection. 4 static <E> Collection<E> checkedCollection() It returns a typesafe view of the particular list dynamically. 5 static <E> List<E> checkedList()
It returns a typesafe view of the specified map. 6 static <K,V> Map<K,V> checkedMap() It returns a dynamically typesafe view of the specified navigable set. 7 static <K,V> NavigableMap<K,V> checkedNavigableMap() It returns a dynamically typesafe view of the specified set. 8 static <E> NavigableSet<E> checkedNavigableSet() It returns a dynamically, typesafe view of the specified type. 9 static <E> Queue<E> checkedQueue() It returns a dynamically typesafe view of the specified sorted map. 10 static <E> Set<E> checkedSet() it returns a dynamically typesafe view of the specified sorted set. 11 static <K,V> SortedMap<K,V> checkedSortedMap() it copies all the elements from one list into another list. 12 static <E> SortedSet<E> checkedSortedSet()
It copies all the elements from one list to another. 13 static <T> void copy() It returns true if the mentioned collections have no common elements. 14 static boolean disjoint() 15 static <T> Enumeration<T> emptyEnumeration() It gets an enumeration with no elements. 16 static <T> Iterator<T> emptyIterator() It gets an iterator with no elements. 17 static <T> List<T> emptyList() It gets a list with no elements. 18 static <T> ListIterator<T> emptyListIterator() It gets a List Iterator with no elements. 19 static <K, V> Map<K,V> emptyMap() It returns an empty immutable map. static <K,V> NavigableMap<K,V> 20 emptyNavigableSet() It returns an empty navigable immutable map.
OTHER METHODS Methods Description It returns the maximum element of the collection, according to the natural ordering of its elements. max(Collection<?extends T> coll) It returns the minimum element of the collection, according to the natural ordering of its elements. min(Collection<?extends T> coll) It randomly permutes the particular list using the specified source of randomness. shuffle(List<?> list Random rnd)
CONCLUSION This article would have helped you understand the Java Collections Class. You can implement the various methods to understand them clearly.