Java List IndexOf indexOfType(List list, Class type)

Here you can find the source of indexOfType(List list, Class type)

Description

index Of Type

License

Apache License

Declaration

public static int indexOfType(List<?> list, Class type) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    public static int indexOfType(List<?> list, Class type) {
        for (int idx = 0; idx < list.size(); idx++) {
            if (type.isInstance(list.get(idx))) {
                return idx;
            }/*from ww w . ja  v  a 2s . c  om*/
        }
        return -1;
    }
}

Related

  1. indexOfMax(List list)
  2. indexOfMax(List list)
  3. indexOfMinSize(final List> sets)
  4. indexOfNull(List list)
  5. indexOfThatStartsWith(List list, String startsWith, int startIndex)