Java Reference
In-Depth Information
Figure 4.1
A
MusicOrganizer
containing two file
names
P
\0XVLF
0XVLF2UJDQL]HU
$U
UD\/LVW6WULQJ!
ILOHV
6WULQJ
6WULQJ
³0RUQLQJ%OXHVPS´
³'RQW*RPS´
Figure 4.2
A
MusicOrganizer
containing three file
names
P
\0XVLF
0XVLF2UJDQL]HU
$U
UD\/LVW6WULQJ!
ILOHV
ILOHV
6WULQJ
6WULQJ
6WULQJ
³0RUQLQJ%OXHVPS´
³'RQW*RPS´
³0DWFK%R[%OXHVPS´
We notice that the
MusicOrganizer
object looks quite simple—it has only a single field that
stores an object of type
ArrayList<String>
. All the difficult work is done in the
ArrayList
object. This is one of the great advantages of using library classes: someone has invested time
and effort to implement something useful, and we are getting access to this functionality almost
for free by using this class.
At this stage, we do not need to worry about
how
an
ArrayList
is able to support these fea-
tures. It is sufficient to appreciate just how useful this ability is. Remember: This suppression of
Search WWH ::
Custom Search