Created
January 11, 2016 08:28
-
-
Save theomega/902ab54572e05bca46f9 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.company; | |
public class Main { | |
public static void main(String[] args) { | |
executeNTimes(10, ((currentIndex, maxIndex, wisdom) -> { | |
System.out.println("Executed run "+currentIndex+" of "+maxIndex+" Wisdom: "+wisdom); | |
})); | |
} | |
public static void executeNTimes(int n, CallbackInterface f) { | |
for(int i=0; i<n; i++) { | |
f.run(i, n, "current daily wisdom"); | |
} | |
} | |
private interface CallbackInterface { | |
void run(int currentIndex, int maxIndex, String dailyWisdom); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment