java:generics_multiple_params
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
java:generics_multiple_params [2017/02/07 17:01] – gthanos | java:generics_multiple_params [2020/03/10 09:52] (current) – gthanos | ||
---|---|---|---|
Line 12: | Line 12: | ||
</ | </ | ||
- | <code java OrderedPair.java> | + | <code java SimplePair.java> |
- | public class OrderedPair<K, V> implements Pair< | + | public class SimplePair<K, V> implements Pair< |
private K key; | private K key; | ||
private V value; | private V value; | ||
- | public | + | public |
this.key = key; | this.key = key; | ||
this.value = value; | this.value = value; | ||
Line 31: | Line 31: | ||
Με βάση τον παραπάνω κώδικα μπορείτε να δημιουργήσετε αντικείμενα επιμέρους τύπων ως εξής: | Με βάση τον παραπάνω κώδικα μπορείτε να δημιουργήσετε αντικείμενα επιμέρους τύπων ως εξής: | ||
- | <code java OrderedPairUsage.java> | + | <code java SimplePairUsage.java> |
- | public class OrderedPairUsage | + | public class SimplePairUsage |
public static void main(String args[]) { | public static void main(String args[]) { | ||
- | Pair< | + | Pair< |
- | Pair< | + | Pair< |
- | | + | |
// the following is not allowed | // the following is not allowed | ||
- | Pair< | + | Pair< |
} | } | ||
} | } |
java/generics_multiple_params.1486486919.txt.gz · Last modified: 2017/02/07 17:02 (external edit)