I have Address
class as:
public class Address{
private String city;
private String pincode;
private String state;
}
I have an attribute of different object request
as private List<Address> transitLocations
.
How can I check if transitLocations
contains an address which is having state equals to "SomeString"
in one line.
PS: Please assume all getters & setters are present in code.
I don't want to override equals because Address
class is used at other places too.