java:generics_multiple_params
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| java:generics_multiple_params [2017/02/07 15:06] – created 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.1486480015.txt.gz · Last modified: 2017/02/07 15:06 (external edit)
