Here you can find the source of getFirstOccurNic(List
private static String getFirstOccurNic(List<String> nics, String line)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { private static String getFirstOccurNic(List<String> nics, String line) { int idx = Integer.MAX_VALUE; String result = ""; for (String nic : nics) { int i = line.indexOf(nic); if ((i >= 0) && (i < idx)) { idx = i;/*from w ww. j a v a 2 s.co m*/ result = nic; } } return result; } }