MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / SelfBounded

Class SelfBounded

generics/SelfBounding.java:6–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4// Visit http://OnJava8.com for more book information.
5
6class SelfBounded<T extends SelfBounded<T>> {
7 T element;
8 SelfBounded<T> set(T arg) {
9 element = arg;
10 return this;
11 }
12 T get() { return element; }
13}
14
15class A extends SelfBounded<A> {}
16class B extends SelfBounded<A> {} // Also OK

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected