Here you can find the source of indexOf(Object o, Collection list)
Parameter | Description |
---|---|
o | the o |
list | the list |
public static int indexOf(Object o, Collection list)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.List; public class Main { /**//www . j a v a 2 s.co m * Index of. * * @param list the list * @param w the w * @param n the n * @return the int */ public static int indexOf(List<String> list, String w, int n) { for (int i = n; i < list.size(); i++) { if (list.get(i).equals(w)) return i; } return -1; } /** * get an index of object in the collection. * * @param o the o * @param list the list * @return the int */ public static int indexOf(Object o, Collection list) { int n = 1; for (Object oo : list) { if (oo.equals(0)) { return n; } n++; } return -1; } }