summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-04-06 13:50:00 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-04-06 13:50:00 -0400
commit79d3a4a47cbc1fcf17c77c6fc12ff826a3077bac (patch)
treea69e533c558326d583b3aee891fc815208c7b650 /BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java
parent4355418164c44170cfb329fcbb7e6f1358c0e314 (diff)
Minor bugfixes/changes, as well as beginnings of CLI systems
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java58
1 files changed, 27 insertions, 31 deletions
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<String> splitTokens =
- new FunctionalList<>(
- tokenToSplit.split(operatorRegex));
+ }
- FunctionalList<String> result = new FunctionalList<>();
+ FunctionalList<String> splitTokens = new FunctionalList<>(
+ tokenToSplit.split(operatorRegex));
- int tokenExpansionSize = splitTokens.getSize();
+ FunctionalList<String> 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<FunctionalList<E>> returnedList =
- new FunctionalList<>();
+ FunctionalList<FunctionalList<E>> returnedList = new FunctionalList<>();
/*
* List that holds current partition
*/
- GenHolder<FunctionalList<E>> currentPartition =
- new GenHolder<>(new FunctionalList<>());
+ GenHolder<FunctionalList<E>> 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<FunctionalList<String>> returnedList =
- new GenHolder<>(input);
+ GenHolder<FunctionalList<String>> 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<FunctionalList<String>> returnedList =
- new GenHolder<>(input);
+ GenHolder<FunctionalList<String>> returnedList = new GenHolder<>(
+ input);
operators.forEach((operator) -> returnedList
.transform((oldReturn) -> oldReturn.flatMap((token) -> {