Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @FunctionalInterface
- interface IStringLength {
- public abstract int measureStringLength(String string);
- }
- public class LambdaExercise {
- private IStringLength lambda = (string) -> string.length();
- public IStringLength getLambda() {
- return lambda;
- }
- public void setLambda(IStringLength lambda) {
- this.lambda = lambda;
- }
- public static void main(String[] args) {
- String s = "Hello World";
- int sLength = new LambdaExercise().getLambda().measureStringLength(s);
- System.out.println(sLength);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement