Chapter 16 Flashcards
Java collections framework contain other ______ generic data-structures
Prebuilt
Examples of collections
Contacts list, music playlist, members of sport teams
What do iterators do
Walk through collections
A collection is a _____ ______ (actually an object) that can hold references to other objects
Data structure
Usually collections contain references to objects of any type that has the ______ ___________ (inheritance, composition is a has-a relationship) with the collection’s element type. The collections-framework interfaces declare the operations to be performed generically on various types of collections.
Is-a relationship
Interface Collection is the ______ __________ in the collections hierarchy from which interfaces Set, Queue and List are derived.
Root interface
The collections-framework classes and interfaces are members of package ________
Java.util
As a result, the Object references obtained from a collection needed to be ________ to an appropriate type to allow the program to process the objects correctly. __________ should be avoided
Downcast
Wrapper classes
Boolean, Byte, Character, Double, Float, Integer, long and short
T/F
Wrapper classes are final classes so you can’t extend them. Primitive types do not have methods, so the methods related to a primitive type are located in the corresponding type-wrapper class
T
takes primitives (int, double, Boolean, float, etc) and turn them into reference (Double, Integer, etc) types (generic classes/containers require reference classes).
converts a primitive type to an object of the corresponding type-wrapper class (reference type). Performed automatically
Boxing
Our of reference into primitive type
Unboxing
What are proper generic classes
ArrayList, LinkedList, Iterator, Map, Set
___________ is the same as an array, but it is dynamic/mutable (resizable).
ArrayList
T/F the List interface is implemented by ArrayList and LinkedList
True