The generic collection library | CodeGuru

The generic collection library

Bruce Eckel’s Thinking in Java Contents | Prev | Next You’ve seen in this chapter that the standard Java library has some fairly useful collections, but far from a complete set. In addition, algorithms like sorting are not supported at all. One of the strengths of C++ is its libraries, in particular the Standard Template […]

Written By
CodeGuru Staff
CodeGuru Staff
Mar 1, 2001
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

You’ve


seen in this chapter that the standard Java library has some fairly useful


collections, but far from a complete set. In addition, algorithms like sorting


are not supported at all. One of the strengths of C++ is its libraries, in


particular the

Standard
Template Library

(STL) that provides a fairly full set of collections as well as many algorithms
like sorting and searching that work with those collections. Based on this
model, the
ObjectSpace
company was inspired to create the
Generic
Collection Library

for
Java
(formerly
called the
Java
Generic Library
,
but the abbreviation JGL is still used – the old name infringed on
Sun’s copyright), which follows the design of the STL as much as possible
(given the differences between the two languages). The JGL seems to fulfill
many, if not all, of the needs for a collection library, or as far as one could
go in this direction without C++’s template mechanism. The JGL includes
linked lists, sets, queues, maps, stacks, sequences, and iterators that are far
more functional than
Enumeration,
as well as a full set of

algorithms
such as searching and sorting. ObjectSpace also made, in some cases, more
intelligent design decisions than the Sun library designers. For example, the
methods in the JGL collections are
not
final so it’s easy to inherit and override those methods.

The


JGL has been included in some vendors’ Java distributions and ObjectSpace


has made the JGL freely available for all uses, including commercial use, at


http://www.ObjectSpace.com

.


The online documentation that comes in the JGL package is quite good and should


be adequate to get you started.


Contents

|

Prev

|

Next
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.