When writing a data structure, what should be our guidelines for choosing the right Java Collection?
The guidelines that should be followed while choosing a Java collection is given as follows :
These Use Cases should also be kept in mind :
List: When we need to store or iterate through a number of things, then List is used.
Set: When the items that have already been processed need to be remembered in order to take yes or no decision, then Set can be used.
Map: When the case need to be stored as key-value pairs or association.
Queue: When there is need to have different queues in order to perform different functions like sequential data processing and different compression techniques etc., Queue can be used.
These were the basic criteria or guidelines. Besides these, some other basic guidelines or pointers are as follows :
Comments
this is amazing touch on the topic. I really enjoyed the material. Thank you for this great research paper.
Leave a comment