before ask i saw [this question](https://stackoverflow.com/questions/41437771/compare-two-list-objects) too. but i didn't get that.

I have two lists.

```
List<Contact> serverContacts

```

`serverContacts` have 4 item
and

```
List<Contact> phoneContact

```

have 20 item.

**and my Contact model is** 

```
private String firstName;
private String id;
private String lastName;
private LinkedUser linkedUser;
private String cellphoneNumber;
private String email;
private String uniqueId;
private long notSeenDuration;
private boolean hasUser;

```

**This is the method for doing compare**

```
List<Contact> serverContacts = adapter.fromJson(chatMessage.getContent());
if (serverContacts != null) {
    List<Contact> phoneContact = getPhoneContact(getContext());
    for (int i = 0; i < phoneContact.size(); i++) {
        if (serverContacts.size() > i) {
            if(phoneContact.get(i).getCellphoneNumber().equals(serverContacts.get(i).getCellphoneNumber())) {
                System.out.println("Match Found " + i);
            }
        }
    }
}

```

My `phone contact` list just fill two param of the `Contact` model, `cellphoneNumber` and `firstName`.
Becuase the two object of these two lists are not exactly the same, I mean just one of them in these two have the same `cellphoneNumber`. Then I tried to compare these two based on `cellphoneNumber`.

> 
> I think this might work when both of them have the same size.!!
> 
> 
>