dimanche 3 avril 2016

Having trouble with iterating through an ArrayList (Java) [duplicate]

This question already has an answer here:

I don't understand why the following if statement never hits, I've verified through the log that movie and films.get(i).getTitle() are the same string:

List<Film> films = new ArrayList<Film>();
films = filmDB.getAllFilms();



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

                if(movie == films.get(i).getTitle())
                {
                    Log.d("TITLEMOVIE", films.get(i).getTitle());
                    ;
                }
            else
                {
                    Log.d("NOMATIC", films.get(i).getTitle());
                }

Aucun commentaire:

Enregistrer un commentaire