Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    public static int indexOfItem(ArrayList<String> list, final String item) {
        if (item == null || list.isEmpty()) {
            return -1;
        }
        for (int i = 0; i < list.size(); i++) {
            if (item.equals(list.get(i))) {
                return i;
            }
        }
        return -1;
    }
}