public static void main(String[] args) { List list = new ArrayList(); list.add("java"); list.add("b"); list.add("c"); list.add("d"); // int index = index(list,"e"); // boolean isset = isSet(list,"java"); boolean isset = list.contains("b"); System.out.println(isset); } public static int index(List list, Object other){ for(int i = 0;i<list.size();i++){ Object obj = list.get(i); if(obj.equals(other)){ return i; } } return -1; } public static boolean isSet(List list, Object other){ int index = index(list,other); if(index>=0){ return true; }else{ return false; } }