OnJava8-Examples/generics/SelfBoundingMethods.java

11 lines
235 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: generics/SelfBoundingMethods.java
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());
}
} ///:~