Last active
October 14, 2015 20:28
-
-
Save timyates/0467463f4647ba51e1bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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