You are creating a contacts list to save the name of your contacts and their phone numbers. You want to retrieve a list of phone numbers by searching on the name. Which structure would you use?

HashSet ArrayList HashMap HashMap is the correct structure as it allows you to save the name of the contact with more than one phone number per contact saved as an ArrayList

You are saving the SSN numbers of people working in a company. You do not want any duplicate entries. Which structure would you use?

HashSet ArrayList HashMap In a set you cannot have duplicates and since it is only SSN number being saved you can use a HashSet

An ArrayList automatically increases its size when more elements are added to it. True or False

True False

Can you sort the names of people stored in an ArrayList in ascending or descending order? If so what is the name of the method? Look into the ArrayList documentation to answer this question.

Yes, using sort method No, sort method is not there for ArrayList

results matching ""

    No results matching ""