Search code examples
javaarraysarraylistobject-oriented-database

Java ArrayList<>() Fetch


I have FilmDAO which have List getAllFilm(), in the main i have :

List <Film> lsfilm = new ArrayList <Film>();
lsfilm = FilmDAO.getAllFilm();

My question is how to fetch the list objects one by one, and get only the name of the movie (nomFilm) so i can add it in the Choice list (ComboBox).


Solution

  • Somthing like this :)

     if(CollectionUtils.isNotEmpty(lsfilm)){
        for (Film film : lsfilm){
           comboBox.add(film.getNameFilm());
        }
        }