1 / 7

Collections Class in Java

https://firstcode.school/collections-class-in-java/

ayushii12
Download Presentation

Collections Class in Java

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COLLECTIONS CLASS IN JAVA Presentation by Firstcode

  2. 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.

  3. 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()

  4. 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()

  5. 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.

  6. 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)

  7. CONCLUSION This article would have helped you understand the Java Collections Class. You can implement the various methods to understand them clearly.

More Related