Javatpoint Logo
Javatpoint Logo

Flyweight Pattern

A Flyweight Pattern says that just "to reuse already existing similar kind of objects by storing them and create new object when no matching object is found".

Advantage of Flyweight Pattern

  • It reduces the number of objects.
  • It reduces the amount of memory and storage devices required if the objects are persisted

Usage of Flyweight Pattern

  • When an application uses number of objects
  • When the storage cost is high because of the quantity of objects.
  • When the application does not depend on object identity.

Example of Flyweight Pattern

UML and Example coming soon...





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials