From a2c7425458f645802a352abc4783e0afc73dba13 Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Thu, 3 Dec 2020 19:22:35 -0500 Subject: Adapt to esodata changes --- .../main/java/bjc/utils/funcutils/ListUtils.java | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'base/src/main/java/bjc/utils/funcutils/ListUtils.java') diff --git a/base/src/main/java/bjc/utils/funcutils/ListUtils.java b/base/src/main/java/bjc/utils/funcutils/ListUtils.java index e3662af..17642ce 100644 --- a/base/src/main/java/bjc/utils/funcutils/ListUtils.java +++ b/base/src/main/java/bjc/utils/funcutils/ListUtils.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.function.*; import bjc.funcdata.FunctionalList; -import bjc.funcdata.IList; +import bjc.funcdata.ListEx; /** * Utilities for manipulating FunctionalLists and regular Collections lists that @@ -27,7 +27,7 @@ public class ListUtils { * * @return The collapsed string of tokens. */ - public static String collapseTokens(final IList input) { + public static String collapseTokens(final ListEx input) { if (input == null) throw new NullPointerException("Input must not be null"); return collapseTokens(input, ""); @@ -45,7 +45,7 @@ public class ListUtils { * * @return The collapsed string of tokens. */ - public static String collapseTokens(final IList input, + public static String collapseTokens(final ListEx input, final String seperator) { if (input == null) throw new NullPointerException("Input must not be null"); else if (seperator == null) throw new NullPointerException("Seperator must not be null"); @@ -89,9 +89,9 @@ public class ListUtils { * @return A new list containing the desired number of items randomly selected * from the specified list without replacement. */ - public static IList drawWithoutReplacement(final IList list, + public static ListEx drawWithoutReplacement(final ListEx list, final int number, final Function rng) { - final IList selected = new FunctionalList<>(new ArrayList<>(number)); + final ListEx selected = new FunctionalList<>(new ArrayList<>(number)); final int total = list.getSize(); @@ -133,9 +133,9 @@ public class ListUtils { * @return A new list containing the desired number of items randomly selected * from the specified list. */ - public static IList drawWithReplacement(final IList list, final int number, + public static ListEx drawWithReplacement(final ListEx list, final int number, final Function rng) { - final IList selected = new FunctionalList<>(new ArrayList<>(number)); + final ListEx selected = new FunctionalList<>(new ArrayList<>(number)); for (int i = 0; i < number; i++) selected.add(list.randItem(rng)); @@ -161,7 +161,7 @@ public class ListUtils { * * @return A list partitioned according to the above rules. */ - public static IList> groupPartition(final IList input, + public static ListEx> groupPartition(final ListEx input, final Function counter, final int partitionSize) { if (input == null) { throw new NullPointerException("Input list must not be null"); @@ -176,10 +176,10 @@ public class ListUtils { } /* List that holds our results. */ - final IList> returned = new FunctionalList<>(); + final ListEx> returned = new FunctionalList<>(); /* List that holds elements rejected during current pass. */ - final IList rejected = new FunctionalList<>(); + final ListEx rejected = new FunctionalList<>(); final GroupPartIteration it = new GroupPartIteration<>(returned, rejected, partitionSize, counter); @@ -215,10 +215,10 @@ public class ListUtils { * @return A list containing all the elements of the lists. */ @SafeVarargs - public static IList mergeLists(final IList... lists) { - final IList returned = new FunctionalList<>(); + public static ListEx mergeLists(final ListEx... lists) { + final ListEx returned = new FunctionalList<>(); - for (final IList list : lists) { + for (final ListEx list : lists) { for (final E itm : list.toIterable()) returned.add(itm); } @@ -249,12 +249,12 @@ public class ListUtils { * If the list couldn't be padded to the * desired size. */ - public static IList padList(final IList list, + public static ListEx padList(final ListEx list, final Function counter, final int size, final Supplier padder) { int count = 0; - final IList returned = new FunctionalList<>(); + final ListEx returned = new FunctionalList<>(); for (final E itm : list.toIterable()) { count += counter.apply(itm); @@ -433,12 +433,12 @@ public class ListUtils { */ class GroupPartIteration implements Consumer { /* The list we're returning. */ - private final IList> returnedList; + private final ListEx> returnedList; /* The current partition of the list. */ - public IList currentPartition; + public ListEx currentPartition; /* The items rejected from the current partition. */ - private final IList rejectedItems; + private final ListEx rejectedItems; /* The number of items in the current partition. */ private int numberInCurrentPartition; @@ -465,7 +465,7 @@ class GroupPartIteration implements Consumer { * @param eleCount * The function to use to determine the value of an item. */ - public GroupPartIteration(final IList> returned, final IList rejects, + public GroupPartIteration(final ListEx> returned, final ListEx rejects, final int nPerPart, final Function eleCount) { this.returnedList = returned; this.rejectedItems = rejects; -- cgit v1.2.3