+ 1
What is the point of the Collection class and why is it used to only sort arrays?
1 Respuesta
0
A collection represents a group of objects, known as its elements. The magic word is "group of objects". Array is a container object that holds fixed number of values of a single type.
Collections give us options to interact with those objects. We have 3 main collections type: Sets, Lists and Queue. Some collections allow duplicate elements and others do not. Some are ordered and others unordered.
Collection of players exemple:
ArrayList<Player> thePlayersList = new ArrayList<Player>();
Array of 5 players exemple:
Player[] thePlayers = new Player[5];