use union/diff operator on Sets (optimization)
This commit is contained in:
parent
b7fecaff37
commit
777a400b12
6 changed files with 15 additions and 18 deletions
|
|
@ -19,7 +19,7 @@ case class TwoPhaseSet(
|
|||
def remove(element: String): TwoPhaseSet =
|
||||
copy(removals = removals.add(element))
|
||||
|
||||
def elements: Set[String] = adds.elements -- removals.elements
|
||||
def elements: Set[String] = adds.elements diff removals.elements
|
||||
|
||||
override def merge(that: TwoPhaseSet): TwoPhaseSet =
|
||||
copy(
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ object TwitterStreamQuickstartDocSpec {
|
|||
//#model
|
||||
|
||||
//#tweet-source
|
||||
val tweets: Source[Tweet, NotUsed]
|
||||
//#tweet-source
|
||||
val tweets: Source[Tweet, NotUsed] //#tweet-source
|
||||
= Source(
|
||||
Tweet(Author("rolandkuhn"), System.currentTimeMillis, "#akka rocks!") ::
|
||||
Tweet(Author("patriknw"), System.currentTimeMillis, "#akka !") ::
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue