The List collection

The first one is the List collection/interface. A list is an ordered collection, sometimes we call it as a sequence as well. Lists may contain duplicate elements, just like arrays, but there are lots of differences between an array and ArrayList. You can insert multiple values into this List container, and it might contain duplicate elements as well. You can actually add any value and remove any value from any index. Let's say you added 15 elements sequentially into the list, now you want to remove 6th element, or you want to insert an element between the 10th and 11th elements, or you want to know an element at what index it is out of those 15 elements. There are lots of helpful APIs to retrieve elements from the list ...

Get Hands-On Automation Testing with Java for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.