From 61fd71f69e080790da722e0e03b71ecd7c2538a2 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Tue, 10 May 2016 16:02:45 -0400 Subject: General update --- .../main/java/bjc/utils/funcutils/ListUtils.java | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java') 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 ea15a78..913ccc4 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java @@ -8,7 +8,7 @@ import bjc.utils.data.IHolder; import bjc.utils.data.IPair; import bjc.utils.data.Identity; import bjc.utils.funcdata.FunctionalList; -import bjc.utils.funcdata.IFunctionalList; +import bjc.utils.funcdata.IList; /** * Utilities for manipulating FunctionalLists that don't belong in the @@ -28,7 +28,7 @@ public class ListUtils { * The list of tokens to collapse * @return The collapsed string of tokens */ - public static String collapseTokens(IFunctionalList input) { + public static String collapseTokens(IList input) { if (input == null) { throw new NullPointerException("Input must not be null"); } @@ -46,7 +46,7 @@ public class ListUtils { * The seperator to use for seperating tokens * @return The collapsed string of tokens */ - public static String collapseTokens(IFunctionalList input, + public static String collapseTokens(IList input, String seperator) { if (input == null) { throw new NullPointerException("Input must not be null"); @@ -78,8 +78,8 @@ public class ListUtils { * @return The tokens that have been deaffixed * */ - public static IFunctionalList deAffixTokens( - IFunctionalList input, + public static IList deAffixTokens( + IList input, Deque> operators) { if (input == null) { throw new NullPointerException("Input must not be null"); @@ -88,7 +88,7 @@ public class ListUtils { "Set of operators must not be null"); } - IHolder> returnedList = new Identity<>( + IHolder> returnedList = new Identity<>( input); operators.forEach((operator) -> returnedList @@ -115,10 +115,10 @@ public class ListUtils { * selected from the specified list without replacement */ - public static IFunctionalList drawWithoutReplacement( - IFunctionalList list, int numberOfItems, + public static IList drawWithoutReplacement( + IList list, int numberOfItems, Function rng) { - IFunctionalList selectedItems = new FunctionalList<>( + IList selectedItems = new FunctionalList<>( new ArrayList<>(numberOfItems)); int totalItems = list.getSize(); @@ -153,10 +153,10 @@ public class ListUtils { * @return A new list containing the desired number of items randomly * selected from the specified list */ - public static IFunctionalList drawWithReplacement( - IFunctionalList list, int numberOfItems, + public static IList drawWithReplacement( + IList list, int numberOfItems, Function rng) { - IFunctionalList selectedItems = new FunctionalList<>( + IList selectedItems = new FunctionalList<>( new ArrayList<>(numberOfItems)); for (int i = 0; i < numberOfItems; i++) { @@ -181,8 +181,8 @@ public class ListUtils { * The number of elements to put in each partition * @return A list partitioned according to the above rules */ - public static IFunctionalList> groupPartition( - IFunctionalList input, Function elementCounter, + public static IList> groupPartition( + IList input, Function elementCounter, int numberPerPartition) { if (input == null) { throw new NullPointerException("Input list must not be null"); @@ -199,17 +199,17 @@ public class ListUtils { /* * List that holds our results */ - IFunctionalList> returnedList = new FunctionalList<>(); + IList> returnedList = new FunctionalList<>(); /* * List that holds current partition */ - IHolder> currentPartition = new Identity<>( + IHolder> currentPartition = new Identity<>( new FunctionalList<>()); /* * List that holds elements rejected during current pass */ - IFunctionalList rejectedElements = new FunctionalList<>(); + IList rejectedElements = new FunctionalList<>(); /* * The effective number of elements in the current partitition @@ -254,11 +254,11 @@ public class ListUtils { * @return A list containing all the elements of the lists */ @SafeVarargs - public static IFunctionalList mergeLists( - IFunctionalList... lists) { - IFunctionalList returnedList = new FunctionalList<>(); + public static IList mergeLists( + IList... lists) { + IList returnedList = new FunctionalList<>(); - for (IFunctionalList list : lists) { + for (IList list : lists) { list.forEach(returnedList::add); } @@ -279,8 +279,8 @@ public class ListUtils { * @return A list of tokens split on all the operators * */ - public static IFunctionalList splitTokens( - IFunctionalList input, + public static IList splitTokens( + IList input, Deque> operators) { if (input == null) { throw new NullPointerException("Input must not be null"); @@ -289,7 +289,7 @@ public class ListUtils { "Set of operators must not be null"); } - IHolder> returnedList = new Identity<>( + IHolder> returnedList = new Identity<>( input); operators.forEach((operator) -> { -- cgit v1.2.3