From 7d8578dd79ce93e015de8d4ce0e814e4f7d81b4f Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Mon, 30 Oct 2017 17:15:07 +0000 Subject: [PATCH] JAL-2795 changed getting index of identifier to Stream (moved to Java 8) Searching through with Stream prevents having to duplicate the array with Arrays.toList --- src/jalview/ext/forester/ForesterMatrix.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jalview/ext/forester/ForesterMatrix.java b/src/jalview/ext/forester/ForesterMatrix.java index 4ce3d12..5450afe 100644 --- a/src/jalview/ext/forester/ForesterMatrix.java +++ b/src/jalview/ext/forester/ForesterMatrix.java @@ -7,7 +7,7 @@ import java.io.IOException; import java.io.Writer; import java.text.DecimalFormat; import java.text.NumberFormat; -import java.util.Arrays; +import java.util.stream.IntStream; import org.forester.evoinference.matrix.distance.DistanceMatrix; import org.forester.util.ForesterUtil; @@ -58,7 +58,9 @@ public class ForesterMatrix implements DistanceMatrix @Override public int getIndex(final String identifier) { - return Arrays.asList(identifiers).indexOf(identifier); + return IntStream.range(0, identifiers.length) + .filter(x -> identifier.equals(identifiers[x])).findFirst() + .orElse(-1); } /** -- 1.7.10.2