From 79d3a4a47cbc1fcf17c77c6fc12ff826a3077bac Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Wed, 6 Apr 2016 13:50:00 -0400 Subject: Minor bugfixes/changes, as well as beginnings of CLI systems --- .../main/java/bjc/utils/funcutils/ListUtils.java | 58 ++++++++++------------ 1 file changed, 27 insertions(+), 31 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils') diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java index 5eb488a..1d2750b 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java @@ -75,31 +75,30 @@ public class ListUtils { if (StringUtils.containsOnly(tokenToSplit, operatorRegex)) { return new FunctionalList<>(tokenToSplit); - } else { - FunctionalList splitTokens = - new FunctionalList<>( - tokenToSplit.split(operatorRegex)); + } - FunctionalList result = new FunctionalList<>(); + FunctionalList splitTokens = new FunctionalList<>( + tokenToSplit.split(operatorRegex)); - int tokenExpansionSize = splitTokens.getSize(); + FunctionalList result = new FunctionalList<>(); - splitTokens.forEachIndexed((tokenIndex, token) -> { + int tokenExpansionSize = splitTokens.getSize(); - if (tokenIndex != tokenExpansionSize - && tokenIndex != 0) { - result.add(operatorName); - result.add(token); - } else { - result.add(token); - } - }); + splitTokens.forEachIndexed((tokenIndex, token) -> { - return result; - } - } else { - return new FunctionalList<>(tokenToSplit); + if (tokenIndex != tokenExpansionSize + && tokenIndex != 0) { + result.add(operatorName); + result.add(token); + } else { + result.add(token); + } + }); + + return result; } + + return new FunctionalList<>(tokenToSplit); } } @@ -193,14 +192,13 @@ public class ListUtils { /* * List that holds our results */ - FunctionalList> returnedList = - new FunctionalList<>(); + FunctionalList> returnedList = new FunctionalList<>(); /* * List that holds current partition */ - GenHolder> currentPartition = - new GenHolder<>(new FunctionalList<>()); + GenHolder> currentPartition = new GenHolder<>( + new FunctionalList<>()); /* * List that holds elements rejected during current pass */ @@ -214,10 +212,8 @@ public class ListUtils { /* * Run up to a certain number of passes */ - for (int numberOfIterations = - 0; numberOfIterations < MAX_NTRIESPART - && !rejectedElements - .isEmpty(); numberOfIterations++) { + for (int numberOfIterations = 0; numberOfIterations < MAX_NTRIESPART + && !rejectedElements.isEmpty(); numberOfIterations++) { input.forEach(new GroupPartIteration<>(returnedList, currentPartition, rejectedElements, numberInCurrentPartition, numberPerPartition, @@ -265,8 +261,8 @@ public class ListUtils { "Set of operators must not be null"); } - GenHolder> returnedList = - new GenHolder<>(input); + GenHolder> returnedList = new GenHolder<>( + input); operators.forEach((operator) -> returnedList .transform((oldReturn) -> oldReturn.flatMap((token) -> { @@ -296,8 +292,8 @@ public class ListUtils { "Set of operators must not be null"); } - GenHolder> returnedList = - new GenHolder<>(input); + GenHolder> returnedList = new GenHolder<>( + input); operators.forEach((operator) -> returnedList .transform((oldReturn) -> oldReturn.flatMap((token) -> { -- cgit v1.2.3