From 816a5b89c5ddb8e295b8e8e46075da3cb694b2a7 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Mon, 1 Jun 2015 13:10:49 +1000 Subject: Fix up static analysis issues (FindBugs and Intellij IDEA analysis) --- src/main/java/au/id/zancanaro/javacheck/RoseTree.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main/java/au/id/zancanaro/javacheck/RoseTree.java') diff --git a/src/main/java/au/id/zancanaro/javacheck/RoseTree.java b/src/main/java/au/id/zancanaro/javacheck/RoseTree.java index 86952da..5a54d6f 100644 --- a/src/main/java/au/id/zancanaro/javacheck/RoseTree.java +++ b/src/main/java/au/id/zancanaro/javacheck/RoseTree.java @@ -36,8 +36,9 @@ public class RoseTree { } private static Iterator[]> permutations(RoseTree[] trees) { - return Iterators.flatten(Iterators.rangeIterator(trees.length, index -> - Iterators.mappingIterator(child -> { + return Iterators.flatten( + Iterators.rangeIterator(trees.length, + index -> Iterators.mappingIterator(child -> { @SuppressWarnings("unchecked") RoseTree[] result = (RoseTree[]) new RoseTree[trees.length]; for (int i = 0; i < trees.length; ++i) { @@ -45,14 +46,14 @@ public class RoseTree { } return result; }, trees[index].getChildren()) - )); + )); } public static RoseTree zip(Function, R> fn, RoseTree[] trees) { @SuppressWarnings("unchecked") List heads = new ArrayList(trees.length); - for (int i = 0; i < trees.length; ++i) { - heads.add(trees[i].getValue()); + for (RoseTree tree : trees) { + heads.add(tree.getValue()); } return new RoseTree<>( fn.apply(heads), -- cgit v1.2.3