3 ms·
Java has a pattern that is a superset of this, which is the self-recursive generic type: interface Foo<T extends Foo<T>> class Bar implements Foo<Bar>
by tadfisher 2y ago
Java has a pattern that is a superset of this, which is the self-recursive generic type:
interface Foo<T extends Foo<T>>
class Bar implements Foo<Bar>
This is used to implement associated-type and Self-type behavior, at the expense of boilerplate. You can have multiple levels of associated types, though, which is murderous on the pinkies (or whatever finger types the angle bracket keys in your layout).