Java tutorial
//package com.java2s; import java.util.*; public class Main { /** * Returns the index of the given value in the given list, * using == to compare rather than .equals. */ public static <T> int indexOfSafe(List<T> list, T value) { for (int i = 0; i < list.size(); i++) { if (list.get(i) == value) { return i; } } return -1; } }