这个Java语法是什么意思? [英] What does this Java Syntax mean?
问题描述
可能存在重复:
什么是< TYPE>在java中是什么意思?
在下面的代码中,Iterator < V>
和OutputCollector < K,V>
是指?它是一种特殊的数据类型吗?
pre $ $ $ $ $ $ $ $ $ b OutputCollector< K,V>输出,
Reporter记者)抛出IOException {
K代表Key和V,代表HashMap中的值。没有必须实例化或子类化的Key类或Value类,这是泛型的语义。这些字母只是您决定填补关键和价值角色的任何类别的占位符。
Possible Duplicate:
What does the <TYPE> in java mean?
In the code below, what does Iterator<V>
and OutputCollector<K, V>
mean? Is it a special data type?
public void reduce(K key,
Iterator<V> values,
OutputCollector<K, V> output,
Reporter reporter) throws IOException {
K stands for Key and V for Value, like in a HashMap. There isn't a Key class or a Value class that you have to instantiate or subclass, it's a semantic thing for generics. Those letters are only placeholders for whatever classes you decide should fill the Key and Value roles.
这篇关于这个Java语法是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!