added flyweight example

This commit is contained in:
2024-11-04 11:35:09 +01:00
parent dfd4dba1d7
commit f37a8cd665
5 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,15 @@
package learn.simple_flyweight;
public class UnsharedConcreteFlyweight extends Flyweight {
private long allState;
public UnsharedConcreteFlyweight(long allState) {
super();
this.allState = allState;
}
@Override
public void operation(long extrinsicState) {
System.out.println("Unshared Flyweight " + allState + " calling operation with extrinsic state " + extrinsicState);
}
}