Infatti il problema è quello.

Nel mio codice, ho un metodo che trasforma un oggetto List in un array di stringhe.
Questo array di stringhe mi serve proprio per riempire la listModel(AbstractListModel) che a sua volta riempie la jList. E da quello che ho capito l'unico oggetto che s può passare alla listModel è un array di stringhe. Giusto?


Quindi ho il seguente metodo:

codice:
public String[] getArrayString(){

        UserProfile user = Persistence.getCurrentUserProfile();
        ContactsManager contactsManager = new ContactsManager(user);
        String infoUser = "";
        String[] infoUsers = null;
        String name = "";
        String tel = "";

        List<Contact> contactList;
        try {
            contactList = contactsManager.loadContacts();

            infoUsers = new String[contactList.size()];
            int i = 0;
            for (Iterator<Contact> it = contactList.iterator(); it.hasNext();) {
                Contact infoContact = it.next();
                name = infoContact.getName();
                tel = infoContact.getTel();
                if(name.trim().length() > 0 && tel.trim().length() > 0) {
                         infoUser = name + " " + tel;
                         infoUsers[i++] = infoUser;
                    
                }
           }

        } catch (ConnectException ex) {
            ....
        }
        return infoUsers;
    }
Il problema è che devo ridimensionare l'array infoUsers. Questo inizialmente ha una dimensione pari alla List<Contact> che contiene degli elementi che poi devono essere esclusi dall'array di stringhe.
Quindi adesso il problema è ridimensionare l'array di stringhe.
Oppure mi creo un altro oggetto List, dove ci metto gli elementi della prima List che soddisfano la condizione, e poi uno il secondo oggetto List per riempire l'array di stringhe.
Che ne pensate?