OnJava8-Examples/generics/SelfBoundingMethods.java

12 lines
295 B
Java
Raw Normal View History

2015-06-15 17:47:35 -07:00
//: generics/SelfBoundingMethods.java
// <20>2015 MindView LLC: see Copyright.txt
public class SelfBoundingMethods {
static <T extends SelfBounded<T>> T f(T arg) {
return arg.set(arg).get();
}
public static void main(String[] args) {
A a = f(new A());
}
} /* Output: (None) *///:~