tags:

views:

149

answers:

3

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 {
+2  A: 

Sort of. Those are generic types:

http://en.wikipedia.org/wiki/Generics_in_Java

Ian Henry
+2  A: 

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.

omgzor
+5  A: 

Those are Generic types. Check out the tutorial, it is really helpful.

http://download.oracle.com/javase/tutorial/extra/generics/index.html

jjnguy