Java List First Item getFirstOccurNic(List nics, String line)

Here you can find the source of getFirstOccurNic(List nics, String line)

Description

get First Occur Nic

License

Apache License

Declaration

private static String getFirstOccurNic(List<String> nics, String line) 

Method Source Code


//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;
    }
}

Related

  1. getFirstItemOrNull(List items)
  2. getFirstLeaf(List aList)
  3. getFirstNameIndex(List list)
  4. getFirstNonEmptyIndex(final List> list)
  5. getFirstObject(List valueList)
  6. getFirstOrNull(List elements)
  7. getFirstOrNull(List list)
  8. getFirstRowMatch(List list, int columnIndex, T value)
  9. getFirstRowResults(List> llo, String reason)

  10. HOME | Copyright © www.java2s.com 2016