Friday, July 19, 2013

How to perform search against Collect of Custom Objects in Java ?



How to perform search against Collect of Custom Objects in Java ?

Usecase : Identify whether the given EmploeeDTO associated last name exists in the List<EmployeDTO> or not.

- Create EmployeeDTO class and override equals() method as shown below.
- Invoke List.Contains() operation by passing the Custom DTO object, this will invoke internally equals() method and returns true if there are any matching EmployeeDTO matches with the given Object last name.

No comments:

Post a Comment