I have been studying design patterns and came accross the fly weight pattern.  I have been trying to see opportunities to use the pattern in my applications but I am having trouble seeing how to use it.  Also, what are some signs that a fly weight pattern is being used when I read other peoples code?According to the definition it says:Use sharing to support large numbers of fine-grained objects efficiently.If I read it right Dictionaries and Hashtables could be instances of fly weights is this correct?Thanks in advance.
Does anyone have a specific example of using the Flyweight Pattern?
design patterns
One example is in the Java libraries. Java has primitive types (e.g. int, which is a 32-bit integer) and wrappers for them (e.g. Integer, which wraps int). There are methods to box an int into an Integer and unbox an Integer into an int. The wrappers are necessary because the primitive types aren't objects and hence can't e.g. be used as keys in Maps or placed in Collections.The boxing method uses an array of flyweight objects as a kind of cache for Integers corresponding to int values between -128 and 127. Since those are the values most likely to be used as keys or placed in collections, it reduces allocation and memory use. (If there are 5000000 Integers representing the value 0 floating around, that uses 5000000 times as much memory as reusing the flyweight instance).