Ask a Question
Advertise on boostr.in
whats the difference between raw types unbounded wild cards and using object i using -'java,generics,effective-java'
whats the difference between raw types unbounded wild cards and using object i ¬†using -'java,generics,effective-java'
I am reading the chapter on Generics in Effective Java.
Help me understand difference between Set, Set<?> and Set<Object>?
The following paragraph is taken from the book.
¬†¬†As a quick review, Set<Object> is a parameterized type representing a
¬†¬†set ¬†¬†that can contain objects of any type, Set<?> is a wildcard type
¬†¬†representing ¬†a set that can contain only objects of some unknown
¬†¬†type, and Set is a raw type, which opts out of the generic type
What is meant by "some unknown type"? Are all unknown types of type Object? In that case what is the specific difference between Set<?> and Set<Object>?
Sep 7, 2015
to add a comment.
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please