i have a arraylist where i am verifying particular object is existing or not but even it exists it always returns false
- by Raghavender Reddy
hi i have class called userdata which returns the Userarraylist which is of type User. when ever i try to use contains method to check particular property is existing or not it always returns false why?
Actually i want the array list to be generic which should return the objects that are set in array list.
String className = data.getUserData().get(0).getClass().getSimpleName();
if(className.equalsIgnoreCase("User")) {
ArrayList<User> userdata=new ArrayList();
userdata = data.getUserData();
System.out.println(data.getUserData().contains(u.getUserId()));
if(userdata.contains(u.getUserName())) {
System.out.println(userdata.get(0).getEmailId());
}
}