Final Flashcards
The classes that implement the _______ interface are all indexed collections
List
Set objects:
are not indexed do not reveal the order of insertion of items
Denable efficient search and retrieval of information
allow removal of elements without moving other elements around
Relative to a Set, Map objects provide efficient _____ and ______ of entries that contain pairs of objects (a unique key and the information)
search
retrieval
Hash tables (used to implement a Map or Set ) store objects at arbitrary locations and offer an average constant time for ______,_______,_______.
insertion, removal, and searching
is a collection that contains no duplicate elements and at most one null element
A set
Required methods for set interface and methods:
testing set ,
testing for an empty set,
determining set size,
creating an iterator over the set
Additional methods for adding an element and removing an element (the add method does not allow _________________ ).
duplicate items to be inserted
Constructors that enforce the “________________” rule
no duplicate members
Required method: __________ tests the subset relationship
containsAll
Union:
Intersection:
Difference:
addAll
retainAll
removeAll
Unlike the List.add method, the Set.add method returns false if you attempt to:
insert a duplicate item
Unlike a List, a Set does not have a ____ method elements cannot be accessed by index
get
You can iterate through all elements in a Set using an __________ object, but the elements will be accessed in arbitrary order
Iterator
Returns an iterator over the elements in this set.
iterator()
Collections implementing the ____ interface must contain unique elements
Set
Unlike the ______ method, the _____ method returns _____ if you attempt to insert a duplicate item
List.add. Set.add. false
Unlike a _____, a_____ does not have a ____ method-elements cannot be accessed by index
List. Set. get
You can iterate through all elements in a _____ using an ________ object , but the elements will be accessed in arbitrary order
Set. Iterator
The Map is related to the
Set
Mathematically , a _____ is a set of ordered pairs whose elements are known as the key and the value
Map
The collection of all keys is known as the
keySet
The collection of all values is known as the
valueSet
All the elements of ________ have a corresponding member in key Set
valueSet