Learn Java: ArrayLists

Nice work! You now know the basics of ArrayLists including:

  • Creating an ArrayList.
  • Adding a new ArrayList item using add().
  • Accessing the size of an ArrayList using size().
  • Finding an item by index using get().
  • Changing the value of an ArrayList item using set().
  • Removing an item with a specific value using remove().
  • Retrieving the index of an item with a specific value using indexOf().

Now if only there were some way to move through an array or ArrayList, item by item…


We’ve included a workspace for you to test out your newfound knowledge of arrays and ArrayLists.

Remember: To run your code, enter the following in the terminal:

java List
Folder Icon

Take this course for free

Already have an account?