I have following class in which I am going to store name and position of user,
public class NameAndPosition {
private String name = "";
private LatLng position = null;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LatLng getPosition() {
return position;
}
public void setPosition(LatLng position) {
this.position = position;
}
}
And in my MainActivity class I have created an ArrayList of objects of class NameAndPostion,
ArrayList<NameAndPosition> LocSenders = new ArrayList<NameAndPosition>();
In somewhere in my code I want to check if LocSenders contains a user with a given name. I don't want to matter a position here. I just want to check with name in LocSenders ArrayList.
e.g. I have specified a name John then I want to retrieve those objects in ArrayList which has name John.
How to do that?
Thanks in advance.
NameAndPositioninstances with identical name equal to each other, no matter of their position. This is a serious limitation that might not be acceptable.