Interface ReferenceCache

All Known Implementing Classes:

public interface ReferenceCache
The simple interface needed to battle object proliferation when many objects of a type with low cardinality are created. The idea is that you still create the object, but rather than hanging on to it, you pass it through the cache, which may replace your object with a reference to a previously-created object.
  • Method Summary

    Modifier and Type
    <T> T
    Get a shared reference to an object.
  • Method Details

    • getSharedReference

      <T> T getSharedReference(T object)
      Get a shared reference to an object. The contract here is that the returned object is an instance of the same class and compares equal to the passed object.
      object - An object to which you'd like to
      Shared reference to the object.