21. Collections Flashcards
Although there are different kinds of collections, what particular convenience do they all have in common? (Collections API)
s
Name four methods from the Collection interface? Which collections have these methods?
s
What deficiency arguable exists in the use of interfaces as a means of contractual obligation?
s
What features characterize a collection as being a list?
s
What is the type parameter of a List used for?
s
What order does Lists: List interface: iterator() present the elements in?
s
If we have ArrayList al = new ArrayList(); what type is the object referenced by the variable al - is it ArrayList, List, Collection or Object?
ss
How is Lists: ArrayList collection implemented?
d
For which implementation of Lists will add(index) and remove(index) instance methods be slow, and for which will they be fast?
s
How is LinkedList collection implemented?
s
What features characterize a collection as being a map?
s
What are the type parameters of a Map interface used for?
s
How is the TreeMap collection implemented?
s
Howis the HashMap collection implemented?
d
What features characterize a collection as being a set?
s
What is the type parameter of a Set interface used for?
s
What order does the Sets: Set interface: iterator() present the elements in?
s
If we have HashSet hs = new HashSet(); what type is the object referenced by the variable hs - is it HashSet, Set, Collection or Object?
s
How is the TreeSet collection implemented?
s
What order does Sets: TreeSet: iterator() present the elements in?
s
How is HashSet collection implemented?
s
Name a generic class method that is provided in Collections class. What restrictions are placed on its List method argument?
s
What two abstract methods does this have?
s
What two stages are involved in this?
s
What is data stored in at run time? What kinds of things might we want to do with such stored data?
s
What is the consequence of clashes, and how is their occurrence minimized?
s
Why is the data structure called OBT?
s
For what circumstances is linked list better than using an array?
s
What three instance methods does Integer have in order for it to behave properly in the collections classes?
s
What is hashCode() used for, and what properties should it have?
s
What properties must hashCode() have, and what property should it have? How can we achieve this?
s
When should we use a for-each loop with collections?
s