-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
93 lines (84 loc) · 3.61 KB
/
index.html
File metadata and controls
93 lines (84 loc) · 3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Javanotes 9, Chapter 7 -- Arrays, ArrayLists, and Records</title>
<link type="text/css" rel="stylesheet" href="../javanotes.css">
</head>
<body>
<div class="page">
<div align="right">
<small>
[ <a href="s1.html">First Section</a> |
<a href="../c6/index.html">Previous Chapter</a> |
<a href="../c8/index.html">Next Chapter</a> |
<a href="../index.html">Main Index</a> ]
</small>
</div>
<hr>
<div class="content">
<h3 class="chapter_title">Chapter 7</h3>
<h2 class="chapter_title">Arrays, ArrayLists, and Records</h2>
<hr class="break">
<p>
<span class="start"><big>C</big>omputers get a lot of their power</span> from working
with <span class="newword">data structures</span>. A data structure is an
organized collection of related data. An object is a data structure, combined
usually with some methods, but this
type of data structure—consisting of a fairly small number of named instance
variables—is just the beginning. In many cases, programmers build
complicated data structures by hand, by linking objects together. We'll look at
these custom-built data structures in <a href="../c9/index.html">Chapter 9</a>. This
chapter looks at more basic data structures. There is one type of
data structure that is so important and so basic that it is built into every
programming language: the array.</p>
<p>You have already encountered arrays in <a href="../c3/s8.html">Section 3.8</a>
and <a href="../c5/s1.html#OOP.1.4">Subsection 5.1.4</a>. We continue the study of arrays in this chapter,
including some new details of their use and some additional array-processing
techniques. In particular, we will look at the important topic of algorithms for
searching and sorting an array in <a href="../c7/s5.html">Section 7.5</a>.</p>
<p>An array has a fixed size that can't be changed after the array is created.
But in many cases, it is useful to have a data structure that can grow and shrink
as necessary. In <a href="../c7/s3.html">Section 7.3</a>, we will look at a standard class,
<span class="classname">ArrayList</span>, that represents such a data structure.</p>
<p>An array is a numbered sequence of items, all of the same type. A <span class="newword">record</span>
is another kind of standard data structure. Like an array, a record consists of a sequence of items,
but in a record, the items are referred to by name instead of by number, and
the items can be of different types. Any object in Java can be thought of
as a record in this sense, but Java 17 introduced records explicitly
into the language as a special kind of class with certain restrictions.
We will look at record classes in <a href="../c7/s4.html">Section 7.4</a>.</p>
<hr class="break">
<h3>Contents of Chapter 7:</h3>
<ul class="contents">
<li>Section 1: <a href="s1.html">Array Details</a>
</li>
<li>Section 2: <a href="s2.html">Array Processing</a>
</li>
<li>Section 3: <a href="s3.html">ArrayList</a>
</li>
<li>Section 4: <a href="s4.html">Records</a>
</li>
<li>Section 5: <a href="s5.html">Searching and Sorting</a>
</li>
<li>Section 6: <a href="s6.html">Two-dimensional Arrays</a>
</li>
<li>
<a href="exercises.html">Programming Exercises</a>
</li>
<li>
<a href="quiz.html">Quiz on This Chapter</a>
</li>
</ul>
</div>
<hr>
<div align="right">
<small>
[ <a href="s1.html">First Section</a> |
<a href="../c6/index.html">Previous Chapter</a> |
<a href="../c8/index.html">Next Chapter</a> |
<a href="../index.html">Main Index</a> ]
</small>
</div>
</div>
</body>
</html>