Which concept allows generic collections to interoperate with java code that defines collections that use raw types?

Which concept allows generic collections to interoperate with java code that defines collections
that use raw types?

Which concept allows generic collections to interoperate with java code that defines collections
that use raw types?

A.
bytecode manipulation

B.
casting

C.
autoboxing

D.
auto-unboxing

E.
type erasure

Explanation:

The type erasure of its leftmost bound, or type Object if no bound was specified.
Examples:
type parameters type erasure
List<String> List
Map.Entry<String,Long> Map.Entry
<T extends Cloneable & Comparable<T>> Cloneable
<T extends Object & Comparable<T>> Object
<T> T[] toArray(T[] a) Object[] toArray(Object[] a)
The type erasure process can be imagined as a translation from generic Java source code back
into regularJava code. In reality the compiler is more efficient and translates directly to Java byte
code. But the byte codecreated is equivalent to the non-generic Java code.



Leave a Reply 1

Your email address will not be published. Required fields are marked *