From f23ee21ef38e31aa55b0a57848ba94f352944710 Mon Sep 17 00:00:00 2001 From: Joel Therrien Date: Wed, 24 Jul 2019 14:26:08 -0700 Subject: [PATCH] Add utility function for R package --- .../ca/joeltherrien/randomforest/utils/RUtils.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/src/main/java/ca/joeltherrien/randomforest/utils/RUtils.java b/library/src/main/java/ca/joeltherrien/randomforest/utils/RUtils.java index 295881a..d1f4f6f 100644 --- a/library/src/main/java/ca/joeltherrien/randomforest/utils/RUtils.java +++ b/library/src/main/java/ca/joeltherrien/randomforest/utils/RUtils.java @@ -188,4 +188,14 @@ public final class RUtils { return responses; } + public static List produceSublist(List initialList, int[] indices){ + final List newList = new ArrayList<>(indices.length); + + for(int i : indices){ + newList.add(initialList.get(i)); + } + + return newList; + } + }