All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.reactive.container.SubscriptionSet.scala Maven / Gradle / Ivy

The newest version!
package scala.reactive
package container



import scala.collection._



abstract class SubscriptionSet {

  def +=(s: Reactive.Subscription): Unit

  def -=(s: Reactive.Subscription): Unit

  def unsubscribe(): Unit

}


object SubscriptionSet {

  def apply() = new SubscriptionSet {
    private var set = mutable.Set[Reactive.Subscription]()
    def +=(s: Reactive.Subscription) = set += s
    def -=(s: Reactive.Subscription) = set -= s
    def unsubscribe() {
      val oldset = set
      set = mutable.Set()
      for (s <- oldset) s.unsubscribe()
      oldset.clear()
    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy