Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Foo<T> {
- void doFoo(T arg);
- }
- class Bar<T> {
- private T arg;
- private Foo<T> foo;
- Bar(T arg, Foo<T> foo) {
- this.arg = arg;
- this.foo = foo;
- }
- void doBar(){
- this.foo.doFoo(this.arg);
- }
- }
- class FooImpl<T> implements Foo<Supplier<T>> {
- public void doFoo(Supplier<T> arg) {
- System.out.println(arg.get());
- }
- }
- public static void main(String... args) {
- new Bar<>(
- "hello, world!",
- new FooImpl<>()
- ).doBar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement