From 820f68dc08e1de571c6bb256a430fd311cf3dd29 Mon Sep 17 00:00:00 2001 From: Wispy <101812473+WispySparks@users.noreply.github.com> Date: Mon, 20 May 2024 14:18:28 -0500 Subject: [PATCH] [wpimath] Add InterpolatingDoubleTreeMap.ofEntries() (#6635) Co-authored-by: David Vo --- .../InterpolatingDoubleTreeMap.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/wpimath/src/main/java/edu/wpi/first/math/interpolation/InterpolatingDoubleTreeMap.java b/wpimath/src/main/java/edu/wpi/first/math/interpolation/InterpolatingDoubleTreeMap.java index 15c55d091c..010d232146 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/interpolation/InterpolatingDoubleTreeMap.java +++ b/wpimath/src/main/java/edu/wpi/first/math/interpolation/InterpolatingDoubleTreeMap.java @@ -4,6 +4,8 @@ package edu.wpi.first.math.interpolation; +import java.util.Map; + /** * Interpolating Tree Maps are used to get values at points that are not defined by making a guess * from points that are defined. This uses linear interpolation. @@ -13,4 +15,19 @@ public class InterpolatingDoubleTreeMap extends InterpolatingTreeMap... entries) { + InterpolatingDoubleTreeMap map = new InterpolatingDoubleTreeMap(); + for (var entry : entries) { + map.put(entry.getKey(), entry.getValue()); + } + return map; + } }