src/Pure/General/cache.scala
changeset 68268 f13bb379c573
parent 68267 f0899dad4877
child 68397 7433ee1ed7e3
equal deleted inserted replaced
68267:f0899dad4877 68268:f13bb379c573
    15 {
    15 {
    16   private val table =
    16   private val table =
    17     Collections.synchronizedMap(new WeakHashMap[Any, WeakReference[Any]](initial_size))
    17     Collections.synchronizedMap(new WeakHashMap[Any, WeakReference[Any]](initial_size))
    18 
    18 
    19   def size: Int = table.size
    19   def size: Int = table.size
       
    20 
       
    21   override def toString: String = "Cache(" + size + ")"
    20 
    22 
    21   protected def lookup[A](x: A): Option[A] =
    23   protected def lookup[A](x: A): Option[A] =
    22   {
    24   {
    23     val ref = table.get(x)
    25     val ref = table.get(x)
    24     if (ref == null) None
    26     if (ref == null) None