Object not being replaced
<p>I have two lists of contacts, and I want to replace one with another as:</p>

<pre><code>private PhoneCAdapter getContactAdapter(ArrayList&lt;UserAgenda&gt; phoneContacts) throws NetworkConnetionException {     
    List&lt;UserAgenda&gt; serverContacts = WithingsAPI.getInstance().getContactListByType(Common.CONTACT_LIST_TYPE_FILE,"ALL");

    for(UserAgenda pc: phoneContacts){                  
        for(UserAgenda sc : serverContacts){
            if(pc.getEmails() != null){
                ArrayList&lt;String&gt; emailsPc = new ArrayList&lt;String&gt;(pc.getEmails());
                for(String epc: emailsPc){                      
                    ArrayList&lt;String&gt; emailList = new ArrayList&lt;String&gt;(sc.getEmails());                    
                    String emailServer = emailList.get(0);//server contact has only one email                   
                    if(epc.equals(emailServer)){//we have to substitute the object from the server with the phone ones.
                        pc = sc;
                    }
                }
            }
        }
    }   

    PhoneCAdapter ca = new PhoneCAdapter(this, 0, phoneContacts,PhoneContacts.this );
    return ca;
}
</code></pre>

<p>But after the loops my variable phoneContacts still has the same values. Only if I change the fields manually as:</p>

<pre><code>if(epc.equals(emailServer)){
    pc.setUserOfWW(sc.getUserOfWW());                           
    if(sc.getInvited().equals("true")){                             
       pc.setInvited("true");                           
    }
    else{
        pc.setInvited("false");//here we have people who are/arent user of WW
        pc.setId2invite(sc.getId2invite());
    }
}
</code></pre>

<p>How could I replace my object with info from the phone with the user I get from the server, without doing it manually for each field?</p>
