samples/effectivelist/src/org/apidesign/effectivelist/Listable.scala
author Jaroslav Tulach <jtulach@netbeans.org>
Fri, 31 Aug 2012 20:16:57 +0200
changeset 402 e25dbfce40e9
child 403 ebe08056c60c
permissions -rw-r--r--
Example demostrating how to use trait to provide effective implementation of linked list while keeping encapsulation
jtulach@402
     1
package org.apidesign.effectivelist
jtulach@402
     2
jtulach@402
     3
/** A member of a {@link List} that makes keeping references
jtulach@402
     4
 * to previous and next items in the list effective.
jtulach@402
     5
 */
jtulach@402
     6
trait Listable[T <: Listable[T]] {
jtulach@402
     7
  private[effectivelist] var prev : T = _
jtulach@402
     8
  private[effectivelist] var next : T = _
jtulach@402
     9
}