diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-01-04 17:44:25 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-01-04 17:44:43 +0000 |
| commit | 909f9d629808da383e6c9e8e514711382cdc331e (patch) | |
| tree | 968a15b6ab893177e708666500cc339c621ae452 /src/test/resources/java/lambda-this-capture/com | |
| parent | e9eb339f96c3b82bcb6e908c7a86364c768c16f2 (diff) | |
Add WIP test for this capture in lambdas
Diffstat (limited to 'src/test/resources/java/lambda-this-capture/com')
| -rw-r--r-- | src/test/resources/java/lambda-this-capture/com/example/Lambda.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/resources/java/lambda-this-capture/com/example/Lambda.java b/src/test/resources/java/lambda-this-capture/com/example/Lambda.java new file mode 100644 index 0000000..b4aadbf --- /dev/null +++ b/src/test/resources/java/lambda-this-capture/com/example/Lambda.java @@ -0,0 +1,20 @@ +package com.example; + +import java.util.function.Function; + +public class Lambda { + public static int value(int factor) { + return new Lambda(factor).run(); + } + + private final int factor; + + private Lambda(int factor) { + this.factor = factor; + } + + private int run() { + Function<Integer, Integer> function = value -> value * factor; + return function.apply(21); + } +} |
