Java Reference
In-Depth Information
More-sophisticated behavior
Main concepts discussed in this chapter:
using library classes
writing documentation
reading documentation
Java constructs discussed in this chapter:
String , ArrayList , Random , HashMap , HashSet , Iterator , Arrays ,
static , final
In Chapter 4, we introduced the class ArrayList from the Java class library. We discussed
how this enabled us to do something that would otherwise be hard to achieve (in this case, stor-
ing an arbitrary number of objects).
This was just a single example of a useful class from the Java library. The library consists of
thousands of classes, many of which are generally useful for your work and many of which you
will probably never use.
For a good Java programmer, it is essential to be able to work with the Java library and make
informed choices about which classes to use. Once you have started work with the library,
you will quickly see that it enables you to perform many tasks more easily than you would
otherwise have been able to. Learning to work with library classes is the main topic of this
The items in the library are not just a set of unrelated, arbitrary classes that we all have to
learn individually, but are often arranged in relationships, exploiting common characteristics.
Here, we again encounter the concept of abstraction to help us deal with a large amount of
information. Some of the most important parts of the library are the collections, of which the
ArrayList class is one. We will discuss other sorts of collections in this chapter and see that
they share many attributes among themselves, so that we can often abstract from the individual
details of a specific collection and talk about collection classes in general.
New collection classes, as well as some other useful classes, will be introduced and discussed.
Throughout this chapter, we will work on the construction of a single application (the TechSupport
system), which makes use of various different library classes. A complete implementation
Search WWH ::

Custom Search