Skip to content

Instantly share code, notes, and snippets.

@timyates
Last active October 14, 2015 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timyates/0467463f4647ba51e1bc to your computer and use it in GitHub Desktop.
Save timyates/0467463f4647ba51e1bc to your computer and use it in GitHub Desktop.
package com.bloidonia.meddling;
@FunctionalInterface
public interface Source<T> {
default void yield(T value) {
System.out.println(value);
}
default void run() {
apply(this);
}
void apply(Source<T> s);
static void main(String[] args) {
Source<Integer> intSource = (self) -> {
self.yield(1);
self.yield(2);
self.yield(3);
};
intSource.run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment