> 
> So I have this class which reads from 2 files and fills 2 Arraylists
> with Contact Objects. Now I want to Merge these Arraylists to a new
> Arraylist which then I want to Sort and eliminate duplicates. My
> problem is: How do I get the filled Arraylists to another method so I
> can do the sorting?
> Here is my Code:
> 
> 
> 

```
 import java.util.List;
 import java.util.Scanner;

 final class Addressbook{

     public List<Contact> contacts1 = new ArrayList<Contact>();

     public List<Contact> contacts2= new ArrayList<Contact>();

     public List<Contact> allcontacts = new ArrayList<Contact>();

     public void readContacts1(Scanner scanner1) {

         scanner1.useDelimiter(";");

         while (scanner1.hasNext()) {
             final Contact contact= readContacts1(scanner1);
             contacts1.add(Contact);

         }

     }

     public void readContacts2(Scanner scanner2) {

         while (scanner2.hasNext()) {
             final Contact contact = readContacts2(scanner2);
             contacts.add(contact);

         }

 }

     public int ContactSearch1(Contact c) {

         for (int i = 0; i < contacts1.size(); i++)

             if (contacts1.get(i).equals(c))
                 return i;
         return -1;

     }

     public int ContactSearch2(Contact c) {

         for (int i = 0; i < contacts2.size(); i++)

             if (contacts2.get(i).equals(c))
                 return i;
         return -1;

     }

     private static Contact readContact1(Scanner scanner1) {
         scanner1.useDelimiter(";");

         final String name= scanner1.next();
         final String lastname = scanner1.next();
         final String address = scanner1.next();
         final String number = scanner1.next();

         final Contact contact= new Contact(name, lastname, address, number);
         return contact;

     }

     private static Contact ReadContact2(Scanner scanner2) {
         scanner2.useDelimiter(";");

         final String name= scanner2.next();

         final String lastname = scanner2.next();

         final String address = scanner2.next();

         final String number = scanner2.next();

         final Contact contact= new Contact(name, lastname, address, number);
         return contact;

     }

 }

```