Skip to content

Commit

Permalink
add FII fp due to generated double/split lambda for #388
Browse files Browse the repository at this point in the history
  • Loading branch information
mebigfatguy committed Feb 23, 2020
1 parent fac43c8 commit 2de4051
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/samples/java/ex/FII_Sample.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ex;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.BitSet;
import java.util.EnumSet;
import java.util.Iterator;
Expand All @@ -26,7 +27,7 @@ public List<String> getNames(List<Bauble> baubles) {
}

public void addBitSet(BitSet bs, List<Integer> ints) {
ints.forEach(i -> bs.set(i));
ints.forEach(i -> bs.set(i));
}

public List<Bauble> getfpFreeBees(List<Bauble> baubles) {
Expand Down Expand Up @@ -57,7 +58,8 @@ public Bauble get0OnCollect(List<Bauble> baubles) {
}

public List<Bauble> backToBackFilter(Set<Bauble> baubles) {
return baubles.stream().filter(b -> b.getName().equals("diamonds")).filter(b -> b.isFree()).collect(Collectors.toList());
return baubles.stream().filter(b -> b.getName().equals("diamonds")).filter(b -> b.isFree())
.collect(Collectors.toList());
}

public Map<String, Bauble> mapIdentity(List<Bauble> baubles) {
Expand All @@ -73,7 +75,8 @@ public void fpUnrelatedLambdaValue282(Map<String, Bauble> map, BaubleFactory fac
}

public BigDecimal fpCastEliminatesMethodReference282(List<Bauble> baubles) {
return baubles.stream().filter(b -> b.getName().equals("special")).map(b -> (BigDecimal) b.getCost()).findFirst().get();
return baubles.stream().filter(b -> b.getName().equals("special")).map(b -> (BigDecimal) b.getCost())
.findFirst().get();
}

public static <T> Stream<T> fpIiteratorToFiniteStream283(Iterator<T> iterator, boolean parallel) {
Expand All @@ -87,14 +90,17 @@ public void fpUseIdentity283() {
return m;
});
}

public static void foo(Consumer<Void> consumer) {
}

public static void bar342(Runnable runnable) {
foo(_unused -> runnable.run());
}
public boolean fpGeneratedDoubleLambdas(int[] updateCount) {
return Arrays.stream(updateCount).mapToObj(i -> i == 1 ? Boolean.TRUE : Boolean.FALSE).allMatch(b -> b);
}

public static void foo(Consumer<Void> consumer) {
}

public static void bar342(Runnable runnable) {
foo(_unused -> runnable.run());
}

public void put(Function<Map<String, Object>, Map<String, Object>> updateFunction) {
}
Expand Down Expand Up @@ -139,23 +145,18 @@ public boolean whatGiantSay() {
return this != GiantSpeak.BLUB;
}
}

final class FP363
{
public void example(Foo363 foo, String string)
{
perform(() -> foo.foo(string)); // (*)

final class FP363 {
public void example(Foo363 foo, String string) {
perform(() -> foo.foo(string)); // (*)
}

private void perform(Runnable action)
{

private void perform(Runnable action) {
action.run();
}
}


abstract class Foo363
{
abstract class Foo363 {
public abstract void foo(String string);
}
}

0 comments on commit 2de4051

Please sign in to comment.