java:generics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
java:generics [2015/03/15 20:20]
gthanos [Παραμετρικοί τύποι δεδομένων με πολλές παραμέτρους]
java:generics [2015/03/15 20:35]
gthanos [Παραμετρικοί τύποι δεδομένων με πολλές παραμέτρους]
Line 90: Line 90:
  
 <code java OrderedPair.java>​ <code java OrderedPair.java>​
-public class OrderedPair<​K,​ V> implements ​Pair<K, V> {+public class Pair<K, V> {
  
     private K key;     private K key;
     private V value;     private V value;
  
-    public ​OrderedPair(K key, V value) { +    public ​Pair(K key, V value) { 
- this.key = key; +        this.key = key; 
- this.value = value;+        this.value = value;
     }     }
  
-    public K getKey() { return key; }+    ​public void setKey(K key) { this.key = key; } 
 +    public void setValue(V value) { this.value = value; } 
 +    ​public K getKey() ​  ​{ return key; }
     public V getValue() { return value; }     public V getValue() { return value; }
 } }
 +
 </​code>​ </​code>​
  
java/generics.txt · Last modified: 2017/02/17 15:01 by gthanos