- I want know where Collections (e.g. array lists)are is useful in real time web application development. I already know the properties of an array list, like duplicates allowed,insertion order is preserved etc.
- Where the
sort
method is useful(e.g.collections.sort()
). We use sql queries to sort the data in ascending/descending order. - How we realized that thread safety is required/not required.
Asked
Active
Viewed 429 times
-2
1 Answers
0
ArrayList
The class java.util.ArrayList provides resizable-array, which means that items can be added and removed from the list. It implements the List interface.
An ArrayList is a dynamic data structure so it can be used when there is no upper bound on the number of elements.
A simple Array in java is a static data structure, because the initial size of array cannot be changed, so it can be used only when the data has a known number of elements.
Next time before asking such a question try searching yourself. Feedback much appreciated.