Unit 4: Java Container Library
Java's Container Library is comparable to C++ Standard Template
Library. Both provide a set of data containers and associated
operations. As you build systems of increasing complexity, you will
notice that you use certain data structures and operations on the data
and structures over and over again. Experience over decades of computer
science has identified a common set. Those have been collected into a
group of classes of generic data type. This group is the Standard
Template Library in C++ and the Container Library in Java. What we have
is a set of trusted modules that have been tested and tested, over and
over again, by many people engaging with numerous applications. They are
also optimized for speed. There is no reason to write these from
scratch. Having already examined the C++ Standard Template Library, we
now take a deep look at the Java Container Library.
Completing this unit should take you approximately 5 hours.
Upon successful completion of this unit, you will be able to:
- describe the basic components used in the Java Container Library;
- demonstrate the various components within the Java Container Library; and
- solve simple problems using Java container programming.
4.1: Introduction
This subunit offers a quick overview of the JCL so that you gain a sense of the bigger picture before diving into details.
The Java collections framework is a set of classes and interfaces that implement commonly reusable collection data structures. Although referred to as a framework, it works in a manner of a library. The collections framework provides both interfaces that define various collections and classes that implement them. This brief article is a good summary of this topic.
4.2: Details
Now we dig into the details of the Java Collections Framework.
These videos introduce the concept of libraries and then discusses the JCL, while incorporating numerous examples.
In this activity, you will practice creating a basic Java application containing a HashSet object.
In this activity, you will create a basic Java application with a TreeSet object, and you will add items to the TreeSet.
4.3: Further Examples
Having numerous examples on the use of an extensive software library can be very beneficial. This series of videos covers many important classes in the JCL.
The extensiveness of the JCL can make it a trial when deciding which module is the "right" one to use. Actually, more than one module can be used to serve the same purpose, although one may be easier to apply than another. This video has a good discussion on module choice.
This set of videos offers examples on the use of specific JCL modules. You will find the videos useful as you write your own programs.
Unit 4 Assessment
- Receive a grade
Take this assessment to see how well you understood this unit.
- This assessment does not count towards your grade. It is just for practice!
- You will see the correct answers when you submit your answers. Use this to help you study for the final exam!
- You can take this assessment as many times as you want, whenever you want.