Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;

public class Main {
    public static int indexOf(Object o, ArrayList<Object> elementData) {
        if (o == null) {
            for (int i = 0; i < elementData.size(); i++)
                if (elementData.get(i) == null)
                    return i;
        } else {
            for (int i = 0; i < elementData.size(); i++)
                if (o.equals(elementData.get(i)))
                    return i;
        }
        return -1;
    }
}