Arrays and ArrayLists
The course is part of this learning path
This course covers the fundamentals of data structures specifically looking at the regular built-in arrays that Java provides as part of the language, as well as the ArrayList class, which lives in the java.util package.
- Beginner coders or anyone new to Java
- Experienced Java programmers who want to maintain their Java knowledge
- Developers looking to upskill for a project or career change
- College students and anyone else studying Java
This is a beginner-level course and can be taken by anyone with an interest in learning about Java.
We have learned a lot in this section, specifically related to data structures which are containers that hold data. We learned about regular built-in arrays which cannot be resized once created. We also learned about the ArrayList class from which you can create objects that can resize as needed to accommodate an arbitrary number of elements. We also learned that array lists cannot directly hold primitive types and can only hold reference types. In other words, the data they hold as elements are actually addresses to the objects of interest.
However, if we need an ArrayList to use a primitive type, we can rely on wrapper classes. Wrapper classes are special classes of which there are eight corresponding to each of the eight primitives. They also employ autoboxing in which primitives can automatically be placed in an object of their corresponding wrapper class type, and auto-unboxing, which reverses the process, taking a wrapper object and obtaining from it the primitive type that it holds. We also rounded out the section with three projects reinforcing our understanding of the array and ArrayList data structures, as well as introducing the concept of parallel arrays or ArrayLists. In the next section, we will focus on the string and StringBuilder classes, which allow us to work effectively with textual data. I'll see you there.
John has a Ph.D. in Computer Science and is a professional software engineer and consultant, as well as a computer science university professor and department chair.