APCS Unit 7
Array Lists
Array Lists Introduction

Last semester we spent a lot of time looking at how to store information.  First we looked at how to store information in single variables like ‘int’, ‘double’, ’boolean’, and ‘String’ variables.  Then we talked about arrays and all the cool things that both 1-dimensional and 2-dimensional arrays let us do.  However, arrays still had some limitations in how they could be used.  At best, we could describe their use as pretty “clunky”.  This semester we get to start out with a new (and final) way of storing information: the more elegant “ArrayList”!   The goals in this unit is are follows:

  • Learn how to create (instantiate) ArrayLists
  • Learn how to use the various methods that help control ArrayLists
  • Learn how to use for loops and the enhanced for loop to traverse ArrayLists

At the end of the unit, you’ll have another great tool for storing data: the ArrayList! I think you’ll find that ArrayLists are a lot more versatile and helpful than simple arrays were, though they’ll have some of their own limitations too.

Part 1: Creating ArrayLists

Array List Introduction

The first part of our unit focuses on the creation (instantiation) of ArrayLists.  Many of the starting work with ArrayLists will feel like the starting concepts of arrays.  We’ll create them in their own way, but then look at different ways to add elements to the ArrayList.  Probably the coolest new feature that ArrayLists will give us is the .add() method that lets us add some new element ‘e’ to the ArrayList into a specific spot ’s’, and everything else in the ArrayList will shift around it.  We’ll get a chance to try it all out and see how it works!

GRADING & PROCESS

 Watch the four videos introducing ArrayLists and take a full page of notes on the topics discussed

 Complete all 8 Java Tasks on ArrayLists

 Have Mr. Benshoof confirm your working programs

Storing Data in an ArrayList

ArrayLists & For Loops

More ArrayList Details

Every new tool we getting programming comes along with a variety of methods that let us work with them.  Just like we had to learn about .nextInt() and .nextDouble() when we started working with Scanner objects, so too will we need to learn new methods as we get used to ArrayList objects.  Our job in this part of the unit is to get used to the variety of methods that are available to us with ArrayLists, and then to compare how they work to how similar concepts work with regular arrays.

GRADING & PROCESS

 Watch the videos from our wbsite that get into more of the details about working with ArrayLists.  Take a full page of notes on these concepts.

 Complete the 4 Java Tasks from this section by using ARRAYS ONLY

 Now, complete the same 4 Java Tasks using ARRAYLISTS ONLY

 In your engineering notebook, create a Venn Diagram to compare/contrast the use of arrays vs arraylists

 Have Mr. Benshoof check off your completed programs and your Venn Diagram!

 

 

Classes & ArrayLists

Wrapper Classes

Part 3: ArrayLists in Action

Review: What Are Classes & Objects

The final part of our unit will have us using ArrayLists in a variety of ways to store instances of other classes we’ve written.  Just like we could have an array of ZooKeeper objects, or an array of Bear objects, we can also have ArrayLists of ZooKeeper or Bear objects.  In this final part of the unit you’ll work through just four java tasks that ask us to start combining these many ideas into larger programs!

GRADING & PROCESS

 Read through the upcoming Java Tasks and take a page of brainstorming notes about how these things can be coded.

 Complete the 4 Java Tasks for this final part of the unit!

 Write a 1-Page log on ArrayLists, their function, and the benefits of having them available as a tool

 Have Mr. Benshoof confirm your working programs

Review: What Are Objects

Using ArrayLists

APCS Unit 7 Map
Looking for something?  Here you'll find a library of links to all the documents, images, and videos needed here in APCS Unit 7.