Source: https://people.scs.carleton.ca/~lanthier/teaching/JavaNotes/COMP1405_Ch06_Loops and ArrayLists.pdf