From 47313d5a766bf970095228c1b577244f7fc55415 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Mon, 6 Jul 2015 23:47:20 +1000 Subject: Fix up some minor code-quality things --- src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java | 12 +++++++----- .../java/au/id/zancanaro/javacheck/junit/Properties.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/main/java/au/id/zancanaro/javacheck') diff --git a/src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java b/src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java index ddef800..9c51a7e 100644 --- a/src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java +++ b/src/main/java/au/id/zancanaro/javacheck/ShrinkTree.java @@ -56,20 +56,22 @@ public class ShrinkTree { public static Stream[]> promoteChildren(ShrinkTree[] trees) { return IntStream.range(0, trees.length) .mapToObj(index -> trees[index].getChildren().map(child -> - (ShrinkTree[]) IntStream.range(0, trees.length) + IntStream.range(0, trees.length) .mapToObj(i -> (i == index ? child : trees[i])) - .toArray(ShrinkTree[]::new))) - .flatMap(x -> x); + .toArray(ShrinkTree[]::new))) + .flatMap(x -> x) + .map(x -> (ShrinkTree[]) x); } @SuppressWarnings("unchecked") public static Stream[]> removeChildren(ShrinkTree[] trees) { return IntStream.range(0, trees.length) .mapToObj(index -> - (ShrinkTree[]) IntStream.range(0, trees.length) + IntStream.range(0, trees.length) .filter(i -> i != index) .mapToObj(i -> trees[i]) - .toArray(ShrinkTree[]::new)); + .toArray(ShrinkTree[]::new)) + .map(x -> (ShrinkTree[]) x); } public static Stream[]> removeAndPromoteChildren(ShrinkTree[] trees) { diff --git a/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java b/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java index 175cd6c..9e6414a 100644 --- a/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java +++ b/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java @@ -85,7 +85,7 @@ public class Properties extends BlockJUnit4ClassRunner { } else { Generator[] generators = Arrays.stream(method.getGenericParameterTypes()) .map(param -> provider.getGenerator(param, new Annotation[0], provider)) - .toArray(Generator[]::new); + .toArray(Generator[]::new); Generator> generator = Generator.tuple(generators); long seed = getSeed(method); -- cgit v1.2.3