I have 2 `ArrayList`. And I want elements with common `phone`.

```
ArrayList<Contact> phone_contacts;
ArrayList<Contact> registered_users;

```

I used below method to get common elements:

```
ArrayList<Contact> common_contacts = new ArrayList<Contact>(phone_contacts);
common_contacts.retainAll(registered_users);

```

But, the result I get is empty. How can I get common phone contact in `common_contacts` ArrayList?

**Contact**

```
public class Contact {
    private String name;
    private String phone;

    public Contact(String name, String phone) {
        this.name = name;
        this.phone = phone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
}

```