Java List IndexOf indexOfIdentical(List list, Object value)

Here you can find the source of indexOfIdentical(List list, Object value)

Description

Returns the index in list of the first occurrence identical to value , or -1 if list does not contain value .

License

BSD License

Declaration

public static int indexOfIdentical(List list, Object value) 

Method Source Code

//package com.java2s;
/*/*  w w  w  .  j  a  v  a  2s .co m*/
 *  This file is part of the jasm project (http://code.google.com/p/jasm).
 *
 *  This file is licensed to you under the BSD License; You may not use
 *  this file except in compliance with the License. See the LICENSE.txt
 *  file distributed with this work for a copy of the License and information
 *  regarding copyright ownership.
 */

import java.util.List;

public class Main {
    /**
     * Returns the index in {@code list} of the first occurrence identical to {@code value}, or -1 if
     * {@code list} does not contain {@code value}. More formally, returns the lowest index
     * {@code i} such that {@code (list.get(i) == value)}, or -1 if there is no such index.
     */
    public static int indexOfIdentical(List list, Object value) {
        int i = 0;
        for (Object element : list) {
            if (element == value) {
                return i;
            }
            ++i;
        }
        return -1;
    }
}

Related

  1. indexOf(List lines, String... conditions)
  2. indexOf(List list, T string, int beginIndex)
  3. indexOf(Object o, Collection list)
  4. indexOfFactory(List factories, Class classInstance)
  5. indexOfId(List aList, Object anObj)
  6. indexOfIdentity(List l, T t)
  7. indexOfIgnoreCase(List values, String target)
  8. indexOfInstance(List list, Object object)
  9. indexOfInstance(List list, Class type)