diff --git a/rhodecode/public/js/mode/clike/scala.html b/rhodecode/public/js/mode/clike/scala.html --- a/rhodecode/public/js/mode/clike/scala.html +++ b/rhodecode/public/js/mode/clike/scala.html @@ -19,7 +19,7 @@ } html, form, .CodeMirror, .CodeMirror-scroll { - height: 100%; + height: 100%; } @@ -44,7 +44,7 @@ import parallel.ParIterable /** A template trait for traversable collections of type `Traversable[A]`. - * + * * $traversableInfo * @define mutability * @define traversableInfo @@ -54,15 +54,15 @@ * {{{ * def foreach[U](f: Elem => U): Unit * }}} - * Collection classes mixing in this trait provide a concrete + * Collection classes mixing in this trait provide a concrete * `foreach` method which traverses all the * elements contained in the collection, applying a given function to each. * They also need to provide a method `newBuilder` * which creates a builder for collections of the same kind. - * + * * A traversable class might or might not have two properties: strictness * and orderedness. Neither is represented as a type. - * + * * The instances of a strict collection class have all their elements * computed before they can be used as values. By contrast, instances of * a non-strict collection class may defer computation of some of their @@ -71,13 +71,13 @@ * * `scala.collection.immutable.Stream`. * A more general class of examples are `TraversableViews`. - * + * * If a collection is an instance of an ordered collection class, traversing * its elements with `foreach` will always visit elements in the * same order, even for different runs of the program. If the class is not * ordered, `foreach` can visit elements in different orders for * different runs (but it will keep the same order in the same run).' - * + * * A typical example of a collection class which is not ordered is a * `HashMap` of objects. The traversal order for hash maps will * depend on the hash codes of its elements, and these hash codes might @@ -94,7 +94,7 @@ * @define Coll Traversable * @define coll traversable collection */ - trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] + trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] with FilterMonadic[A, Repr] with TraversableOnce[A] with GenTraversableLike[A, Repr] @@ -131,15 +131,15 @@ protected[this] def parCombiner = ParIterable.newCombiner[A] /** Applies a function `f` to all elements of this $coll. - * + * * Note: this method underlies the implementation of most other bulk operations. * It's important to implement this method in an efficient way. - * + * * * @param f the function that is applied for its side-effect to every element. * The result of function `f` is discarded. - * - * @tparam U the type parameter describing the result of function `f`. + * + * @tparam U the type parameter describing the result of function `f`. * This result will always be ignored. Typically `U` is `Unit`, * but this is not necessary. * @@ -167,7 +167,7 @@ * such as `Stream`, the predicate returns `true` if all elements have been computed. * It returns `false` if the stream is not yet evaluated to the end. * - * Note: many collection methods will not work on collections of infinite sizes. + * Note: many collection methods will not work on collections of infinite sizes. * * @return `true` if this collection is known to have finite size, `false` otherwise. */ @@ -188,16 +188,16 @@ /** Concatenates this $coll with the elements of a traversable collection. * It differs from ++ in that the right operand determines the type of the * resulting collection rather than the left one. - * + * * @param that the traversable to append. - * @tparam B the element type of the returned collection. + * @tparam B the element type of the returned collection. * @tparam That $thatinfo * @param bf $bfinfo * @return a new collection of type `That` which contains all elements * of this $coll followed by all elements of `that`. - * + * * @usecase def ++:[B](that: TraversableOnce[B]): $Coll[B] - * + * * @return a new $coll which contains all elements of this $coll * followed by all elements of `that`. */ @@ -219,7 +219,7 @@ def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = { val b = bf(repr) - b.sizeHint(this) + b.sizeHint(this) for (x <- this) b += f(x) b.result } @@ -238,7 +238,7 @@ */ def filter(p: A => Boolean): Repr = { val b = newBuilder - for (x <- this) + for (x <- this) if (p(x)) b += x b.result } @@ -269,14 +269,14 @@ * The order of the elements is preserved. * * @usecase def filterMap[B](f: A => Option[B]): $Coll[B] - * + * * @param pf the partial function which filters and maps the $coll. * @return a new $coll resulting from applying the given option-valued function * `f` to each element and collecting all defined results. * The order of the elements is preserved. def filterMap[B, That](f: A => Option[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { val b = bf(repr) - for (x <- this) + for (x <- this) f(x) match { case Some(y) => b += y case _ => @@ -288,7 +288,7 @@ /** Partitions this $coll in two ${coll}s according to a predicate. * * @param p the predicate on which to partition. - * @return a pair of ${coll}s: the first $coll consists of all elements that + * @return a pair of ${coll}s: the first $coll consists of all elements that * satisfy the predicate `p` and the second $coll consists of all elements * that don't. The relative order of the elements in the resulting ${coll}s * is the same as in the original $coll. @@ -348,7 +348,7 @@ } /** Finds the first element of the $coll satisfying a predicate, if any. - * + * * $mayNotTerminateInf * $orderDependent * @@ -419,7 +419,7 @@ * @return a $coll consisting of all elements of this $coll * except the first one. * @throws `UnsupportedOperationException` if the $coll is empty. - */ + */ override def tail: Repr = { if (isEmpty) throw new UnsupportedOperationException("empty.tail") drop(1) @@ -465,7 +465,7 @@ def take(n: Int): Repr = slice(0, n) - def drop(n: Int): Repr = + def drop(n: Int): Repr = if (n <= 0) { val b = newBuilder b.sizeHint(this) @@ -501,7 +501,7 @@ val b = newBuilder if (until <= from) b.result else { - b.sizeHintBounded(until - from, this) + b.sizeHintBounded(until - from, this) sliceInternal(from, until, b) } } @@ -555,7 +555,7 @@ * * @return an iterator over all the tails of this $coll * @example `List(1,2,3).tails = Iterator(List(1,2,3), List(2,3), List(3), Nil)` - */ + */ def tails: Iterator[Repr] = iterateUntilEmpty(_.tail) /** Iterates over the inits of this $coll. The first value will be this @@ -574,12 +574,12 @@ * or the end of the array is reached, or `len` elements have been copied. * * $willNotTerminateInf - * + * * @param xs the array to fill. * @param start the starting index. * @param len the maximal number of elements to copy. - * @tparam B the type of the elements of the array. - * + * @tparam B the type of the elements of the array. + * * * @usecase def copyToArray(xs: Array[A], start: Int, len: Int): Unit */ @@ -623,7 +623,7 @@ } /** Creates a non-strict view of this $coll. - * + * * @return a non-strict view of this $coll. */ def view = new TraversableView[A, Repr] { @@ -635,10 +635,10 @@ * * Note: the difference between `view` and `slice` is that `view` produces * a view of the current $coll, whereas `slice` produces a new $coll. - * + * * Note: `view(from, to)` is equivalent to `view.slice(from, to)` * $orderDependent - * + * * @param from the index of the first element of the view * @param until the index of the element following the view * @return a non-strict view of a slice of this $coll, starting at index `from` @@ -653,7 +653,7 @@ * restricts the domain of subsequent `map`, `flatMap`, `foreach`, * and `withFilter` operations. * $orderDependent - * + * * @param p the predicate used to test elements. * @return an object of class `WithFilter`, which supports * `map`, `flatMap`, `foreach`, and `withFilter` operations. @@ -678,22 +678,22 @@ * the given function `f` to each element of the outer $coll * that satisfies predicate `p` and collecting the results. * - * @usecase def map[B](f: A => B): $Coll[B] - * + * @usecase def map[B](f: A => B): $Coll[B] + * * @return a new $coll resulting from applying the given function * `f` to each element of the outer $coll that satisfies * predicate `p` and collecting the results. */ def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = { val b = bf(repr) - for (x <- self) + for (x <- self) if (p(x)) b += f(x) b.result } /** Builds a new collection by applying a function to all elements of the * outer $coll containing this `WithFilter` instance that satisfy - * predicate `p` and concatenating the results. + * predicate `p` and concatenating the results. * * @param f the function to apply to each element. * @tparam B the element type of the returned collection. @@ -705,13 +705,13 @@ * concatenating the results. * * @usecase def flatMap[B](f: A => TraversableOnce[B]): $Coll[B] - * + * * @return a new $coll resulting from applying the given collection-valued function * `f` to each element of the outer $coll that satisfies predicate `p` and concatenating the results. */ def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { val b = bf(repr) - for (x <- self) + for (x <- self) if (p(x)) b ++= f(x).seq b.result } @@ -721,15 +721,15 @@ * * @param f the function that is applied for its side-effect to every element. * The result of function `f` is discarded. - * - * @tparam U the type parameter describing the result of function `f`. + * + * @tparam U the type parameter describing the result of function `f`. * This result will always be ignored. Typically `U` is `Unit`, * but this is not necessary. * * @usecase def foreach(f: A => Unit): Unit - */ - def foreach[U](f: A => U): Unit = - for (x <- self) + */ + def foreach[U](f: A => U): Unit = + for (x <- self) if (p(x)) f(x) /** Further refines the filter for this $coll. @@ -740,7 +740,7 @@ * All these operations apply to those elements of this $coll which * satisfy the predicate `q` in addition to the predicate `p`. */ - def withFilter(q: A => Boolean): WithFilter = + def withFilter(q: A => Boolean): WithFilter = new WithFilter(x => p(x) && q(x)) }