Ignoring a collection for saved objects.

Patterns in Java
Collections for States
Kevlin Henney
Listing 6. Ignoring a collection for saved objects.


public class Application
{
    public void saveChanges()
    {
        Iterator workpiece = changed.iterator();
        while(workpiece.hasNext())
            ((Workpiece) workpiece.next()).save();
        changed.clear();
    }
    ...
    private Collection workpieces, changed;
}

About the Author

Kevlin Henney is a Principal Technologist with QA Training in the UK.

Featured

Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.