Searching through with Stream prevents having to duplicate the array
with Arrays.toList
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;
@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);
}
/**