is object In List - Java java.util

Java examples for java.util:List Filter

Description

is object In List

Demo Code


//package com.java2s;
import java.util.ArrayList;

public class Main {
    public static boolean isIn(Object obj, ArrayList list) {
        for (int i = 0; i < list.size(); i++) {
            if (obj.equals(list.get(i)))
                return true;
        }/*from www . j  a  v a 2  s.  c om*/

        return false;
    }
}

Related Tutorials