From the course: Java 8 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Managing resizable arrays with ArrayList

Managing resizable arrays with ArrayList - Java Tutorial

From the course: Java 8 Essential Training

Start my 1-month free trial

Managing resizable arrays with ArrayList

- The Java collections framework is a set of interfaces and classes that make it easy to manage data in your applications. You can manage either ordered or unordered data and you can use one of four categories of classes. Each of these catergories is represented by an interface. Named set, list, deque and map. I'm going to focus in this course, on two of the most commonly used classes from this framework. ArrayList, and HashMap. These are both implementations of two interfaces. ArrayList implements lists, and HashMap implements map. I'll start with ArrayLists in this project. And I'm starting with an empty main method. First, I'm going to declare a list. The list interface is a member of the package Java.util. When I select it, I get an import statement at the top opf my code. Each of these collection objects, including lists and maps, can contain as many items as you want, but it's good practice to declare what type of items they're going to contain. And you do that with something…

Contents