Java List IndexOf indexOf(List list, Object element, int begin, int end)

Here you can find the source of indexOf(List list, Object element, int begin, int end)

Description

index Of

License

Open Source License

Declaration

public static int indexOf(List<?> list, Object element, int begin, int end) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static int indexOf(List<?> list, Object element, int begin, int end) {
        begin = Math.min(begin, list.size());
        end = Math.min(end, list.size());

        if (begin == 0 && end == list.size())
            return list.indexOf(element);

        for (int i = begin; i < end; i++) {
            if (Objects.equals(element, list.get(i)))
                return i;
        }//from w  ww  . j  av  a 2 s .com

        return -1;
    }

    public static int indexOf(List<?> list, Object element, int begin) {
        return indexOf(list, element, begin, list.size());
    }
}

Related

  1. indexOf(final String regex, final List list)
  2. indexOf(int hash, List list)
  3. indexOf(int start, List datas, T target)
  4. indexOf(List data, List token)
  5. indexOf(List source, List target)
  6. indexOf(List lines, String... conditions)
  7. indexOf(List list, T string, int beginIndex)