Collections and Generics
Objectives
Applied
- Given a list of values or objects, write code that creates an array list or linked list to store the values or objects. Then, write code that uses the values or objects in the list.
- Given a list of key-value pairs, write code that creates a hash map or tree map to store the entries. Then, write code that uses the entries in the list.
- Given Java code that uses any of the language elements presented in this chapter, explain what each statement does.
Knowledge
- Describe the similarities and differences between arrays and collections.
- Name the two main types of collections defined by the collection framework and explain how they differ.
- Describe the generics feature and explain how you use it to create typed collections and classes.
- Explain what an array list is and, in general, how it works.
- Explain what autoboxing is.
- Explain what a linked list is and, in general, how it works
- Explain how you would decide whether to use an array list or a linked list for a given application.
- Explain what a queue is and describe the two basic operations that a queue provides.
- Describe the main difference between a hash map and a tree map.
- Explain what an untyped collection is and what you must do to work with one.
- Explain what the legacy collections are.
- Explain when you need to use a wrapper class with untyped collections.