I
I
Ilya2018-04-17 19:02:06
Java
Ilya, 2018-04-17 19:02:06

How to check if an array of objects is empty?

I have an array that consists of films - instances of the FilmItem class :

private ArrayList<FilmItem> filmItems = new ArrayList<>();

How to check if it contains no elements?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Satisfied IT, 2018-04-17
@sidorchik

Read here and see:
One request to Google and the answer is ready, don't be lazy

G
GavriKos, 2018-04-17
@GavriKos

You don't have an array, but an ArrayList. It should have something like count, size or length. If it is equal to zero, then there are no elements.

D
Denis Zagaevsky, 2018-04-17
@zagayevskiy

isEmpty

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question