From d06aa6bd1ba6240558a12c63beccafea3bd95ffe Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Fri, 1 Apr 2016 10:46:07 -0400 Subject: Minor fixes to things --- .../java/bjc/utils/funcdata/FunctionalList.java | 37 +++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java index 9652469..a260d78 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/FunctionalList.java @@ -181,8 +181,8 @@ public class FunctionalList implements Cloneable { // Get the iterator for the other list Iterator rightIterator = rightList.toIterable().iterator(); - for (Iterator leftIterator = - wrappedList.iterator(); leftIterator.hasNext() + for (Iterator leftIterator = wrappedList + .iterator(); leftIterator.hasNext() && rightIterator.hasNext();) { // Add the transformed items to the result list E leftVal = leftIterator.next(); @@ -227,14 +227,14 @@ public class FunctionalList implements Cloneable { * @return A new list containing the flattened results of applying the * provided function. */ - public FunctionalList - flatMap(Function> elementExpander) { - FunctionalList returnedList = - new FunctionalList<>(this.wrappedList.size()); + public FunctionalList flatMap( + Function> elementExpander) { + FunctionalList returnedList = new FunctionalList<>( + this.wrappedList.size()); forEach(element -> { - FunctionalList expandedElement = - elementExpander.apply(element); + FunctionalList expandedElement = elementExpander + .apply(element); // Add each element to the returned list expandedElement.forEach(returnedList::add); @@ -344,8 +344,8 @@ public class FunctionalList implements Cloneable { * @return A new list containing the mapped elements of this list. */ public FunctionalList map(Function elementTransformer) { - FunctionalList returnedList = - new FunctionalList<>(this.wrappedList.size()); + FunctionalList returnedList = new FunctionalList<>( + this.wrappedList.size()); forEach(element -> { // Add the transformed item to the result @@ -366,8 +366,8 @@ public class FunctionalList implements Cloneable { * @return A list containing pairs of this element and the specified * list */ - public FunctionalList> - pairWith(FunctionalList rightList) { + public FunctionalList> pairWith( + FunctionalList rightList) { return combineWith(rightList, Pair::new); } @@ -378,14 +378,13 @@ public class FunctionalList implements Cloneable { * The size of elements to put into each one of the sublists * @return A list partitioned into partitions of size nPerPart */ - public FunctionalList> - partition(int numberPerPartition) { - FunctionalList> returnedList = - new FunctionalList<>(); + public FunctionalList> partition( + int numberPerPartition) { + FunctionalList> returnedList = new FunctionalList<>(); // The current partition being filled - GenHolder> currentPartition = - new GenHolder<>(new FunctionalList<>()); + GenHolder> currentPartition = new GenHolder<>( + new FunctionalList<>()); this.forEach((element) -> { if (isPartitionFull(numberPerPartition, currentPartition)) { @@ -555,7 +554,7 @@ public class FunctionalList implements Cloneable { // Remove trailing space and comma sb.deleteCharAt(sb.length() - 1); - sb.deleteCharAt(sb.length() - 2); + //sb.deleteCharAt(sb.length() - 2); sb.append(")"); -- cgit v1.2.3