What is the point of the Collection class and why is it used to only sort arrays? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

What is the point of the Collection class and why is it used to only sort arrays?

27th Dec 2016, 6:17 PM
A.G.
1 Réponse
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];
29th Dec 2016, 10:14 AM
Felipe Cruz
Felipe Cruz - avatar