24 lines
727 B
Java
24 lines
727 B
Java
// generics/TupleList.java
|
|
// (c)2016 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
|
// Combining generic types to make complex generic types
|
|
import java.util.*;
|
|
import onjava.*;
|
|
import java.util.stream.*;
|
|
|
|
public class TupleList<A, B, C, D>
|
|
extends ArrayList<Tuple4<A, B, C, D>> {
|
|
public static void main(String[] args) {
|
|
TupleList<Vehicle, Amphibian, String, Integer> tl =
|
|
new TupleList<>();
|
|
tl.add(TupleTest2.h());
|
|
tl.add(TupleTest2.h());
|
|
tl.forEach(System.out::println);
|
|
}
|
|
}
|
|
/* Output:
|
|
(Vehicle@18025c, Amphibian@16f27d, hi, 47)
|
|
(Vehicle@7aac27, Amphibian@3abc88, hi, 47)
|
|
*/
|