What’s does Enumeration<?> mean?
Is there any way to represent the general generic?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
<?>syntax is java’s way to specifying that the generic type is "unbounded" – ie it can be "anything".Enumeration<?>is an Enumeration with an "unbounded type" – you can assign an Enumeration of any type to such a variable, for example:However, being unbounded, the nextElement() method of an
Enumeration<?>with return typeObject(even if it’s actually anEnumeration<String>), so you’ll have to cast if you want typed elements:For background, [Enumeration][1] is a typed interface with two methods [hasMoreElements()][2] and
[nextElement()][3]. It was an early (poor) attempt that was superseded by [Iterable][4] and [Iterator][5]. A few old class use it, like [Vector][6] and [StringTokenizer][7].