Android examples for java.util:Collection Find
get Index Of Element from Collection
//package com.book2s; import java.util.Collection; public class Main { public static void main(String[] argv) { Collection set = java.util.Arrays.asList("asdf", "book2s.com"); Object child = "book2s.com"; System.out.println(getIndexOfElement(set, child)); }//from w w w .jav a 2 s . c o m public static <E> int getIndexOfElement(Collection<E> set, Object child) { int i = 0; for (E e : set) { if (e.equals(child)) { return i; } ++i; } return -1; } }