org.onemind.commons.java.lang.ref
Class SoftHashMap.SoftValue

java.lang.Object
  extended by java.lang.ref.Reference<T>
      extended by java.lang.ref.SoftReference
          extended by org.onemind.commons.java.lang.ref.SoftHashMap.SoftValue
Enclosing class:
SoftHashMap

private static class SoftHashMap.SoftValue
extends java.lang.ref.SoftReference

We define our own subclass of SoftReference which contains not only the value but also the key to make it easier to find the entry in the HashMap after it's been garbage collected.


Field Summary
private  java.lang.Object key
           
 
Constructor Summary
private SoftHashMap.SoftValue(java.lang.Object k, java.lang.Object key, java.lang.ref.ReferenceQueue q)
          Did you know that an outer class can access private data members and methods of an inner class? I didn't know that! I thought it was only the inner class who could access the outer class's private information.
 
Method Summary
 
Methods inherited from class java.lang.ref.SoftReference
get
 
Methods inherited from class java.lang.ref.Reference
clear, enqueue, isEnqueued
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

private final java.lang.Object key
Constructor Detail

SoftHashMap.SoftValue

private SoftHashMap.SoftValue(java.lang.Object k,
                              java.lang.Object key,
                              java.lang.ref.ReferenceQueue q)
Did you know that an outer class can access private data members and methods of an inner class? I didn't know that! I thought it was only the inner class who could access the outer class's private information. An outer class can also access private members of an inner class inside its inner class.