
Jessie G. answered 01/31/22
B.S. in Computer Science with 3+ Years of Teaching Experience
ArrayLists are objects which implement the java.util.List interface, and therefore must implement the interfaces methods.
The List interface uses a .size() method to measure the number of elements, so ArrayList implements it's own version of this method which you can use to determine the number of elements in values, with values.size()