9551 grau-weiß
9552 Fliesen Winter
9553 Schwarzer Herzog/Wolters Pilsener
9554 Mc V
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Util { | |
| /** Merges a collection of streams into a single stream. | |
| * | |
| * Returns a sorted stream if all input streams are sorted. | |
| */ | |
| def mergeStreams[A](streams: Traversable[Stream[A]])(implicit ord: Ordering[A]): Stream[A] = { | |
| val streams1 = streams.toList filterNot (_.isEmpty) sortBy (_.head) | |
| if (streams1.isEmpty) | |
| Stream.empty | |
| else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** Implicit class for adding `|>` and `tap` operations to `AnyVal`. | |
| * | |
| * See `http://stackoverflow.com/a/11120847/839131`. | |
| */ | |
| implicit class PipeAndTap[A](val x: A) extends AnyVal { | |
| /** Applies `f` to the underlying value and returns the result. */ | |
| def |>[B](f: A => B) = f(x) | |
| /** Applies `f` to the underlying value `x` (presumably with side effects) | |
| * and returns `x`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val m = Map(0 -> 'a') | |
| for (n <- 0 until 2) { | |
| m.get(n) match { | |
| case Some(x) => println(s"Value found for key $n: $x") | |
| case None => println(s"No value found for key $n") | |
| } | |
| } |
OlderNewer