equal
deleted
inserted
replaced
12 { |
12 { |
13 def apply[A](init: A): Volatile[A] = new Volatile(init) |
13 def apply[A](init: A): Volatile[A] = new Volatile(init) |
14 } |
14 } |
15 |
15 |
16 |
16 |
17 class Volatile[A] private(init: A) |
17 final class Volatile[A] private(init: A) |
18 { |
18 { |
19 @volatile private var state: A = init |
19 @volatile private var state: A = init |
20 def apply(): A = state |
20 def apply(): A = state |
21 def >> (f: A => A) { state = f(state) } |
21 def >> (f: A => A) { state = f(state) } |
22 def >>>[B] (f: A => (B, A)): B = |
22 def >>>[B] (f: A => (B, A)): B = |