#Data Structures
###Resources
- Video - ArrayList: Arrays the easy way
- Unit 0 - ArrayList
- Video - HashMap: Retreiving Objects via a key
- Unit 0 - HashMap
- Video - Sets
- Unit 0 - Sets
###Exercises
Complete these exercises in DataStructures.java
. Please use the Cat.java
class to complete these exercises.
####1. Cool Cats Pt. II
- Create an ArrayList of 5 Cats.
- Use a loop to print the contents of each object in the ArrayList.
####2. Most Frequent Element
Write a method called mostFrequentElement
that takes an ArrayList of Integers and finds the most frequently occurring element in the ArrayList. At the end print the element and its number of occurrences. If there is more than one such element, any one of them may be printed.
Bonus Challenge
What needs to be changed to make this work on an array of Strings?
####3. Pod HashMap
- Create a HashMap that maps the names of all the Access Coders in your Pod to their age.
- Use a loop to print each key-value pair of the HashMap.
####4. canRentACar
Write a method called canRentACar
that takes the Pod HashMap as a parameter and returns whether or not the Pod can rent a car. If one or more studetns is over 25, it should return true
. If no one in the Pod is over 25, it should return false
.