Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.List;
import java.util.ListIterator;

import java.util.function.BiPredicate;

public class Main {
    public static <E> int indexOf(List<E> c, E item, BiPredicate<? super E, ? super E> equalTester) {
        ListIterator<E> iter = c.listIterator();
        while (iter.hasNext()) {
            int index = iter.nextIndex();
            if (equalTester.test(iter.next(), item)) {
                return index;
            }
        }
        return -1;
    }
}