OnJava8-Examples/generics/TupleList.java

21 lines
637 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: generics/TupleList.java
2015-05-29 14:18:51 -07:00
// <20>2015 MindView LLC: see Copyright.txt
2015-04-20 15:36:01 -07:00
// Combining generic types to make complex generic types.
import java.util.*;
import net.mindview.util.*;
public class TupleList<A,B,C,D>
extends ArrayList<FourTuple<A,B,C,D>> {
public static void main(String[] args) {
TupleList<Vehicle, Amphibian, String, Integer> tl =
2015-05-05 11:20:13 -07:00
new TupleList<>();
2015-04-20 15:36:01 -07:00
tl.add(TupleTest.h());
tl.add(TupleTest.h());
for(FourTuple<Vehicle,Amphibian,String,Integer> i: tl)
System.out.println(i);
}
2015-05-18 23:05:20 -07:00
} /* Output: (75% Match)
2015-04-20 15:36:01 -07:00
(Vehicle@11b86e7, Amphibian@35ce36, hi, 47)
(Vehicle@757aef, Amphibian@d9f9c3, hi, 47)
*///:~