I've been looking for a flyweight pattern implementation and gave up after reaching page 20 of Google search. While there are countless stupid examples out there, it seems no one has ever published are reusable implementation in Java.
For me, flyweight really only makes sense if you have to keep many such instances, so it has to be implemented as a collection. What I would like is a Factory that takes a byte/short/int/long mapper implementation, and returns either a List, Set or Map, that looks like a normal Object collection, but stores it's data internally as an array of primitive, thereby saving lots of ram. The mapper would take an object of type X, and map it to a primitive, or do it the other way around.
Is there something like that available somewhere?
[EDIT] I am looking for a Collection library that support this pattern, not just any example, of which there are hundreds.