-2

How do I Return true if the ArrayList is empty, false otherwise?

1 Answers1

1

There is already a method provided by java.

return list.isEmpty();
Deepak M
  • 223
  • 4
  • 14
  • Thank you! I am very new to coding and don't know what is already provided or not. Is there a way to check? – user7590997 Feb 20 '17 at 04:29
  • @user7590997 By looking in the [javadoc](https://docs.oracle.com/javase/8/docs/api/). You can find the `ArrayList` class and click on it to see the methods it provides. But note that `ArrayList` inherits methods from other classes, so be sure to scroll down to see all the methods. Keep this site bookmarked. Even many of us who have years of experience in Java refer to the javadoc a lot. – ajb Feb 20 '17 at 05:02