Java examples for java.util:List Search
Check if list contains an object Based On Entry Identity
//package com.java2s; import java.util.List; public class Main { public static void main(String[] argv) { List list = java.util.Arrays.asList("asdf", "java2s.com"); Object object = "java2s.com"; System.out.println(containsBasedOnEntryIdentity(list, object)); }// w ww . j a v a 2 s .co m public static boolean containsBasedOnEntryIdentity(final List<?> list, final Object object) { for (Object obj : list) { if (obj == object) { return true; } } return false; } }