Computer Science 268: Introduction to Computer Programming (Java)
Study Guide
Unit 7
Read Chapter 7 of the textbook: Arrays and ArrayLists
This chapter revisits arrays and introduces ArrayList. The chapter also covers searching and sorting, two common and important programming operations. The chapter concludes by examining two-dimensional arrays.
Section 7.1 Array Details
This section revisits arrays, covering the for–each loop, arity methods and array literals. The discussion of each will serve to enhance your ability to use arrays in your programs.
Read and review this section carefully.
- 7.1.1 For–each Loops
- 7.1.2 Variable Arity Methods
- 7.1.3 Array Literals
Section 7.2 Array Processing
This section provides examples of how array processing can be employed in the programs you write. It also introduces dynamic arrays.
Read and review this section carefully.
- 7.2.1 Some Processing Examples
- 7.2.2 Some Standard Array Methods
- 7.2.3 RandomStrings Revisited
- 7.2.4 Dynamic Arrays
Section 7.3 ArrayList
This section introduces ArrayList, a standard Java class that provides powerful array processing capabilities.
Read and review this section carefully.
- 7.3.1 ArrayList and Parameterized Types
- 7.3.2 Wrapper Classes
- 7.3.3 Programming With ArrayList
Section 7.4 Searching and Sorting
This section introduces and discusses searching and sorting in Java programs. The section includes some examples of ways you can search and sort.
Read and review this section carefully.
- 7.4.1 Searching
- 7.4.2 Association Lists
- 7.4.3 Insertion Sort
- 7.4.4 Selection Sort
- 7.4.5 Unsorting
Section 7.5 Two-dimensional Arrays
Two-dimensional arrays are an extension of one-dimensional arrays, but they are considerably more complex because you must keep track of the second dimension. This section includes a discussion of two-dimensional arrays, programming tips for two-dimensional arrays, and a couple examples.
Note that the complete programs provided in the textbook involve GUI programming. Examine the core two-dimensional aspects of the examples, but do not worry about the GUI components.
Read and review this section carefully. GUI programming does not fall within the scope of this course.
- 7.5.1 The Truth About 2D Arrays
- 7.5.2 Conway’s Game Of Life
- 7.5.3 Checkers
It is a good practice to attempt the programming exercises in the textbook, to put the topics you have learned into concrete Java code. This, in turn, allows you to reflect on the material you have read. Skip any exercises relating to topics in Chapter 7 that are not covered in the course.
Resist the temptation to download the programming exercises from the textbook and simply run them. The greatest benefit in learning to program in a new language occurs when you type all the example code yourself.
Typing the code, even for simple examples, engages your brain in the process of writing code, compiling code, running code, and diagnosing and resolving problems that may arise. It is the latter skill—problem solving—that can become the most powerful tool in learning to program.
It is a good practice to review the chapter quizzes in the textbook, as the questions allow you to reflect on the material you have read.