/*
 * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
 * Copyright (C) 2005 - Javolution (http://javolution.org/)
 * All rights reserved.
 * 
 * Permission to use, copy, modify, and distribute this software is
 * freely granted, provided that this notice is preserved.
 */
package javolution37.javolution.lang;

/**
 * 

This interface identifies classes whose instances are not subject or * susceptible to change or variation after creation. Once a class is * declared immutable, any subclass must ensure immutability as well.

* *

{@link Immutable} objects can safely be used in a multi-threaded * environment and do not require defensive copying. * For example:[code] * class Polygon implements Immutable { * private List _vertices; * public Polygon(List vertices) { * _vertices = (vertices instanceof Immutable) ? * vertices : // Safe, the vertices cannot be modified by the client. * new FastTable(vertices); // Defensive copying required. * } * }[/code]

* @see * Wikipedia: Immutable Object * * @author Jean-Marie Dautelle * @version 3.7, February 6, 2006 */ public interface Immutable { // Tagging interface, no method. }

Ads help maintain this website.