Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
Derk Norton edited this page Dec 11, 2022 · 29 revisions

Java Collection Framework

THIS REPOSITORY HAS BEEN ARCHIVED AND IS NO LONGER SUPPORTED

A Better Java Collection Framework

The Java language development team that created the original java.util collection classes was fairly new to object oriented design and collection frameworks and therefore made some common mistakes:

  • using implementation inheritance instead of delegation (a Stack is not a Vector!)
  • exposing underlying implementations (e.g. hashtable, linked list, and tree)
  • confusing ordered and sortable collections (e.g. SortedSet which is really an ordered set)

We forgive them, however, since they got a lot of things right 😉.

Subsequent additions to the java.util package helped address some of these issues, but the designers were somewhat constrained by the original mistakes to maintain backward compatibility.

A Clean Slate

This project starts with a clean slate. It defines a set of Java collection classes that are independent of the java.util collection classes but that still interoperate with them and also integrate with the built-in Java language features that depend on the java.lang.Iterable interface. These classes provide the following nice features:

  • simple, easy to understand interfaces
  • self-optimizing implementations
  • a well designed framework in which to work

Intuitive Indexing

There is a long standing tradition of using zero-based indexing when accessing arrays and collections. This dates back to the days of C where the indexes were referring directly to offsets in memory. The need for this convention has long passed, and it is now time to follow a more intuitive indexing strategy that makes sense to humans and fits in better with the additional reversed indexing style supported by many of the newer scripting languages. The Crater Dog Technologies™ collections use ordinal-based indexing as follows:

Index:       1         2        3        4         5
  or    [ "first", "second", "third", "fourth", "last" ]
Index:      -5        -4       -3       -2        -1

To begin using the Crater Dog Technologies™ Java Collection Framework, follow the links displayed in the sidebar to the right.