design pattern allows you to add responsibilities to existing objects at runtime.
Although you can use subclassing to add functionality to a class, using the decorator pattern at runtime is more flexible.
Although I developed the demo source as a Net Beans IDE 5.0 project, the demo's ANT script does not require that you use that IDE to compile or execute the application.
The demo application uses the decorator design pattern to provide additional functionality to the object you already use.
This article describes how to produce sorted lists and uses a simple application to demonstrate concepts.
Now, deselect all items in the list and check the output on the console. It will print an empty list.package net.codejava.swing; import