[英]In Java, what does does the method signature Enumeration<? extends ZipEntry> mean?
In Java, what does does the method signature Enumeration<? extends ZipEntry>
在Java中,方法签名
Enumeration<? extends ZipEntry>
Enumeration<? extends ZipEntry>
means? Enumeration<? extends ZipEntry>
意味着什么?
It is defining a generic enumeration type. 它定义了一个通用的枚举类型。 I just don't know what the
?
我只是不知道是什么
?
means. 手段。 It seems that it's saying that a new type is being defined and all the compiler needs to know is that the new type extends
ZipEntry
. 似乎它说正在定义一个新类型,并且所有编译器需要知道的是新类型扩展了
ZipEntry
。 Is that accurate? 那是准确的吗?
This is the context of the code: 这是代码的上下文:
for (Enumeration<? extends ZipEntry> e = zipfile.entries();
e.hasMoreElements(); fileNumber++)
{
// ...etc...
}
If I were to speak Enumeration<? extends ZipEntry>
如果我要说
Enumeration<? extends ZipEntry>
Enumeration<? extends ZipEntry>
in english, what would be said? 用英语
Enumeration<? extends ZipEntry>
会怎么说?
Thanks! 谢谢!
It means "an Enumeration
of some definite, but unspecified type that extends ZipEntry
". 它表示“扩展
ZipEntry
的一些明确但未指定类型的Enumeration
”。
See: Upper Bounded Wildcards in Oracle's tutorial about generics, and Angelika Langer's Java Generics FAQ . 请参阅:Oracle关于泛型的教程中的上边界通配符 ,以及Angelika Langer的Java泛型常见问题解答 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.