Java Generics concept public class Pair<K, V> [closed]

SZA

New Member
\[code\]public class Pair<K, V> { // (1) private K key; // (2) private V value; // (3) // Generic constructor public Pair(K key, V value) { // (4) this.key = key; this.value = http://stackoverflow.com/questions/15796839/value; }}\[/code\]Please look line number (1). What does \[code\]<K, V>\[/code\] mean and what is it good for? In line number (2), K has been used as data type as well as in line number (4).
 
Back
Top