From: kjvdheide Date: Mon, 30 Oct 2017 17:15:07 +0000 (+0000) Subject: JAL-2795 changed getting index of identifier to Stream (moved to Java 8) X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7d8578dd79ce93e015de8d4ce0e814e4f7d81b4f;p=jalview.git 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 --- 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); } /**