Book Image

Hands-On Automation Testing with Java for Beginners

Book Image

Hands-On Automation Testing with Java for Beginners

Overview of this book

Java is one of the most commonly-used software languages by programmers and developers. Are you from a non-technical background and looking to master Java for your automation needs? Then Hands-On Automation Testing with Java for Beginners is for you. This book provides you with efficient techniques to effectively handle Java-related automation projects. You will learn how to handle strings and their functions in Java. As you make your way through the book, you will get to grips with classes and objects, along with their uses. In the concluding chapters, you will learn about the importance of inheritance and exceptions with practical examples. By the end of this book, you will have gained comprehensive knowledge of Java.
Table of Contents (17 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

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 container, which we don't get in arrays. Arrays can only be initialized; apart from that, you cannot perform any methods on an array, whereas with ArrayList you have lots of flexible methods to play around with.

The List interface is a collection, and ArrayList...