Collection

First let’s see the collections advantages over array

  1. Continuous memory
  2. Unused memory will be wasted
  3. cannot say the array size upfront

Collection is basically called a collection of objects Interfaces – all are contracts

  1. Set – ex: playing cards – no order is maintained- no duplicate elements are present
  2. List – ex: Grocery list – insertion order- can have duplicates!
  3. Map