2015-09-07 11:44:36 -06:00
|
|
|
// generics/TupleList.java
|
2015-06-15 17:47:35 -07:00
|
|
|
// Combining generic types to make complex generic types.
|
|
|
|
import java.util.*;
|
2015-11-11 20:20:04 -08:00
|
|
|
import onjava.*;
|
2015-06-15 17:47:35 -07:00
|
|
|
|
2015-09-07 11:44:36 -06:00
|
|
|
public class TupleList<A, B, C, D>
|
2015-11-11 20:20:04 -08:00
|
|
|
extends ArrayList<Tuple4<A, B, C, D>> {
|
2015-06-15 17:47:35 -07:00
|
|
|
public static void main(String[] args) {
|
|
|
|
TupleList<Vehicle, Amphibian, String, Integer> tl =
|
|
|
|
new TupleList<>();
|
|
|
|
tl.add(TupleTest.h());
|
|
|
|
tl.add(TupleTest.h());
|
2015-11-11 20:20:04 -08:00
|
|
|
for(Tuple4<Vehicle,Amphibian,String,Integer> i: tl)
|
2015-06-15 17:47:35 -07:00
|
|
|
System.out.println(i);
|
|
|
|
}
|
2015-09-07 11:44:36 -06:00
|
|
|
}
|
|
|
|
/* Output:
|
2015-06-15 17:47:35 -07:00
|
|
|
(Vehicle@139a55, Amphibian@1db9742, hi, 47)
|
|
|
|
(Vehicle@106d69c, Amphibian@52e922, hi, 47)
|
2015-09-07 11:44:36 -06:00
|
|
|
*/
|