Created
July 24, 2016 14:48
-
-
Save fredlahde/6d024c29fee700566e65f05397b48426 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
import java.util.Collection; | |
import java.util.HashSet; | |
class TestKlasse { | |
public TestKlasse() { | |
} | |
} | |
interface Buildable<T> { | |
void build(int x, Collection<T> c); | |
} | |
interface Destroyable<T> { | |
void destroy(T x); | |
} | |
public class FancyStuff { | |
public static void main(String[] args) { | |
Buildable b = (Buildable<TestKlasse>) (count, c) -> { | |
for (int i = 0; i < count; i++) { | |
c.add(new TestKlasse()); | |
} | |
}; | |
Destroyable destroyer = (Destroyable<TestKlasse>) (testKlasse) | |
-> System.out.println(testKlasse + "is kapuut jetzt"); | |
Collection set = new HashSet(); | |
b.build(20, set); | |
set.forEach(destroyer::destroy); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment