Java Generics Flashcards
Why use java generics
To avoid rewriting code to be used for lots of different types
Instead write one which will have a generic type that can be implemented for all types
between what symbols should the type be put in between
< >
what is a primitive type in java
the predefined data types eg int, string, long, float, boolean
what is a wrapper in java
a way to use the primitive types as objects
what is the Int wrapper class
Integer
What happens if a client modifies the data structure while iterating?
A fail-fast iterator throws a java.util.ConcurrentModificationException.
when a class is initialised what will the placeholder be replaced with
the actual type
what is the issue with the operation
object 1 == object 2
will only compare the memory addresses, but most of the time, we do not want to know this
What does the comparable interface return if the objects are the same
0