Submitted by heartin on Sun, 09/27/2015 - 17:30
Collection framework in Java provides a set of readily usable efficient implementations for commonly used data structures and algorithms. A basic understanding of the data constructs like arrays, String, linked list, stack, queue and trees, and concepts like hashing, will help you understand collections better. Collections are often used along with the Generics feature to provide reusable and type safe implementations for these data structures and algorithms.
Submitted by heartin on Sun, 07/05/2020 - 08:18
Creating ArrayList
There are three constructors for creating an ArrayList:
-
When you create an ArrayList using the constructor ArrayList(), the internal array for storage is created with a size 10.
-
The constructor ArrayList(int initialCapacity) allows us to set the initial capacity.
Submitted by heartin on Sun, 07/05/2020 - 05:29
ArrayList is a resizable-array implementation of the List interface.
Submitted by heartin on Sat, 10/10/2015 - 22:46
TreeSet Class implements NavigableSet and is based on a TreeMap.
Important properties of a TreeMap class
-
The elements are ordered using their natural ordering, or by a Comparator
-
Provides guaranteed log(n) time cost for the basic operations like add, remove and contains.
Submitted by heartin on Sat, 10/10/2015 - 19:52
Set is a collection that models the mathematical set abstraction and contains no duplicate elements.
Important properties of Set interface
-
Sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element.
-
The Set interface places additional stipulations on:
Pages