Level 169 Level 171
Level 170

[Quiz] Generics


42 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
}
Define a class called MyClass that extends MySuperclass and implements Yourinterface.
public.
'equals()', 'hashCode()', and 'toString()' are ...
Use '==' to determine if ...
two reference variables refer to the same object.
two object are meaningfully equavalent.
Use 'equals' to determine if ...
useful hashing keys.
If you don't override 'equals()', your objects won't be ...
considered equals.
If you don't override 'equals()', different objects can't be ...
String and wrappers override ...
'equals()' and make good hashing keys.
When overriding 'equals()', use ...
the 'instanceof()' operator to be sure you are evaluating an appropriate class.
the object's significant attributes.
When overriding 'equals()', compare ...
Reflexive: x.equals(x) is true.
Highlights of the 'equals()' contract:
True.
In Java, Exceptions are objects. True or false?
hashcode().
If you override equals(), override ...
Hashing
Using the value of the key as its position in the table.
must be equal.
If two objects are equal, their hashcodes
the same value for all instances.
It is legal for a hashCode() method to return ...
equals() and hashCode().
'transient' variables aren't appropriate for ...
Attributes of ArrayList:
fast iteration and fast random access.
Attributes of Vector:
it's like slower ArrayList, but it has synchronized methods.
Attributes of LinkedList:
good for adding elements to the ends, i.e., stacks and queues.
Attributes of HashSet:
fast access, assures no duplicates, provides no ordering.
Attributes of LinkedHashSet:
no duplicates; iterates by insertion order.
Attributes of TreeSet:
no duplicates; iterates in sorted order.
Attributes of HashMap:
fastest updates (key/value pairs); allows one 'null' key, many 'null' values.
Attributes of Hashtable:
like a slower HashMap (as with Vector, due to its synchronized methods). No 'null' values or 'null' keys allowed.
Attributes of LinkedHashMap:
faster iterations; iterates by insertion order or last accessed; allows one 'null' key, many 'null' values.
Attributes of TreeMap:
a sorted map.
Attributes of PriorityQueue:
a to-do list ordered by the elements' priority.
Sorting can be in ...
natural order, or via a Comparable or many Comparators.
Implement Comparable using ...
compareTo(); provides only one sort order.
compare().
Create many Comparators to sort a class many ways; implement ...
comparable.
To be sorted or searched, a List's elements must be ...
sorted.
To be searched, an array or List must first be ...
Generics let you enforce ...
compile-time type safety on Collections (or other classes and methods declared using generic type parameters).
compile-time safety only.
Generic type information does not exist at runtime - it is for ...
Wildcard syntax (?) allows ...
a generic method, accepts subtypes (or supertypes) of the declared type of the method argument:
The wildcard keyword 'extends' is used to mean ...
either "extends" or "implements". So in <? extends Dog>, Dog can be a class or interface.
accessed but not modified.
When using a wildcard, List<? extends Dog>, the collection can be ...
When using a wildcard, List<?>, ...
any generic type can be assigned to the reference, but for access only, no modifications.
any type object, but for access only.
List<Object> refers only to a List<Object>, while List<?> or List<? extends Object> can hold ...
When using a wildcard, List<? super Dog>, the collection can accept ...
the type on the right-hand side of 'super'(Dog) or any of its supertypes.
Error, Exception
If you throw error, cannot catch exception
LinkedHashSet
Ordered version of Hashset, maintains doubly linked-elements, sorted by insertion order