Browse Source

Refactored Functional Interface (Consumer<Integer>) to Specialized

Primitive Functional Interface.
pull/128/head
Harshrajsinh Thakor 7 years ago
parent
commit
d15956a5a6

+ 4
- 4
dcevm/src/test/java8/com/github/dcevm/test/lambdas/LambdaTest.java View File

import org.junit.Test; import org.junit.Test;


import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.function.Consumer;
import java.util.function.IntConsumer;


import static com.github.dcevm.test.util.HotSwapTestHelper.__toVersion__; import static com.github.dcevm.test.util.HotSwapTestHelper.__toVersion__;
import static com.github.dcevm.test.util.HotSwapTestHelper.__version__; import static com.github.dcevm.test.util.HotSwapTestHelper.__version__;
} }
} }


public static void methodWithLambdaParam(Consumer<Integer> consumer) {
public static void methodWithLambdaParam(IntConsumer consumer) {
consumer.accept(1); consumer.accept(1);
} }


// version 0 // version 0
public static class LambdaC3 { public static class LambdaC3 {
public int i = 0; public int i = 0;
public Consumer<Integer> l = x -> i += x;
public IntConsumer l = x -> i += x;


public void doit() { public void doit() {
LambdaTest.methodWithLambdaParam(l); LambdaTest.methodWithLambdaParam(l);
// version 1 // version 1
public static class LambdaC3___1 { public static class LambdaC3___1 {
int i = 0; int i = 0;
public Consumer<Integer> l = null;
public IntConsumer l = null;


public void doit() { public void doit() {
LambdaTest.methodWithLambdaParam(l); LambdaTest.methodWithLambdaParam(l);

Loading…
Cancel
Save