Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javolution.lang
Interface Immutable

All Known Subinterfaces:
  ValueType

All Known Implementing Classes:
  CharSet, Index, QName, Text

    public interface Immutable

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.

`Immutable` objects can safely be used in a multi-threaded environment and do not require defensive copying. For example:``

         class Polygon implements Immutable {
              private List<Point2D> _vertices;
              public Polygon(List<Point2D> vertices) {
                  _vertices = (vertices instanceof Immutable) ?
                       vertices : // Safe, the vertices cannot be modified by the client.
                       new FastTable<Point2D>(vertices); // Defensive copying required.
              }
         }

Version:
  3.7, February 6, 2006
Author:
  Jean-Marie Dautelle
See Also:
  Wikipedia: Immutable Object

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 - 2009 Javolution.