Q1: What is a collection?
A java collection is a container that holds objects in a certain structure, is an implementation of a data structure. Many operations can be perform on the data such.
Q: What operations can be perform on a collection?
All operations, sorting, insertion, manipulation and deletion.
Q: What are the benefits of a using a collection?
- performing certain tasks with the right collection can be fast
- can utilize the set of optimized algorithms in the collection class
- all collections implement the Collection interface, allowing them to use the same methods
Q: What is the main difference between list and Arraylist collection?
List is an interface which extends the collection interface, its data structure stores the collection of objects in insertion order, allowing duplicates.
Arraylist is a class that implements list and it uses a dynamic array meaning its size is not fixed. Elements in an Arraylist can be randomly accessed.