Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit b9ff618

Browse files
Fix errors in the scaladoc
1 parent d8e69d6 commit b9ff618

File tree

7 files changed

+29
-31
lines changed

7 files changed

+29
-31
lines changed

src/main/scala/strawman/collection/ArrayOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ class ArrayOps[A](val xs: Array[A])
5252

5353
def ++[B >: A : ClassTag](xs: Iterable[B]): Array[B] = fromTaggedIterable(View.Concat(toIterable, xs))
5454

55-
def zip[B: ClassTag](xs: Iterable[B]): Array[(A, B)] = zipWith(xs)((_, _))
55+
def zip[B: ClassTag](that: Iterable[B]): Array[(A, B)] = zipWith(that)((_, _))
5656

57-
def zipWith[B, R: ClassTag](xs: Iterable[B])(f: (A, B) => R): Array[R] = fromTaggedIterable(View.ZipWith(toIterable, xs, f))
57+
def zipWith[B, R: ClassTag](that: Iterable[B])(f: (A, B) => R): Array[R] = fromTaggedIterable(View.ZipWith(toIterable, that, f))
5858
}
5959

6060
case class ArrayView[A](xs: Array[A]) extends IndexedView[A] {

src/main/scala/strawman/collection/Iterable.scala

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -829,34 +829,32 @@ trait IterableOps[+A, +CC[X], +C] extends Any {
829829
* by combining corresponding elements in pairs.
830830
* If one of the two collections is longer than the other, its remaining elements are ignored.
831831
*
832-
* @param xs The iterable providing the second half of each result pair
832+
* @param that The iterable providing the second half of each result pair
833833
* @tparam B the type of the second half of the returned pairs
834-
* @return a new collection of type `That` containing pairs consisting of
835-
* corresponding elements of this $coll and `that`. The length
836-
* of the returned collection is the minimum of the lengths of this $coll and `that`.
834+
* @return a new $coll containing pairs consisting of corresponding elements of this $coll and `that`.
835+
* The length of the returned collection is the minimum of the lengths of this $coll and `that`.
837836
*/
838-
def zip[B](xs: Iterable[B]): CC[(A @uncheckedVariance, B)] = zipWith(xs)((_, _))
839-
837+
def zip[B](that: Iterable[B]): CC[(A @uncheckedVariance, B)] = zipWith(that)((_, _))
840838
// sound bcs of VarianceNote
841839

842-
/** Returns a $coll formed by the result of applying a function to each pair of corresponding elements
843-
* from this $coll and another iterable collection. It is semantically equivalent to `(xs zip ys) map f`.
840+
/** Returns a $coll formed by the result of applying a function to each pair of corresponding elements from
841+
* this $coll and another iterable collection. It is semantically equivalent to `(xs zip ys) map f`.
844842
* If one of the two collections is longer than the other, its remaining elements are ignored.
845843
*
846-
* @param xs The iterable providing the second half of each combined pair
844+
* @param that The iterable providing the second half of each combined pair
847845
* @param f The function to apply to each pair of elements
848846
* @tparam B the type of the elements in the second half of the combined pairs
849847
* @tparam R the type of the elements in the resulting collection
850-
* @return a new collection of type `That` containing the results of applying the given function `f`
851-
* to each pair of corresponding elements of this $coll and `that`. The length
852-
* of the returned collection is the minimum of the lengths of this $coll and `that`.
848+
* @return a new $coll containing the results of applying the given function `f` to each pair of
849+
* corresponding elements of this $coll and `that`. The length of the returned collection
850+
* is the minimum of the lengths of this $coll and `that`.
853851
*/
854-
def zipWith[B, R](xs: Iterable[B])(f: (A, B) => R): CC[R] = fromIterable(View.ZipWith(toIterable, xs, f))
852+
def zipWith[B, R](that: Iterable[B])(f: (A, B) => R): CC[R] = fromIterable(View.ZipWith(toIterable, that, f))
855853

856854
/** Zips this $coll with its indices.
857855
*
858-
* @return A new collection of type `That` containing pairs consisting of all elements of this
859-
* $coll paired with their index. Indices start at `0`.
856+
* @return A new $coll containing pairs consisting of all elements of this $coll paired with their index.
857+
* Indices start at `0`.
860858
* @example
861859
* `List("a", "b", "c").zipWithIndex == List(("a", 0), ("b", 1), ("c", 2))`
862860
*/

src/main/scala/strawman/collection/SortedSet.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ trait SortedSetOps[A, +CC[X] <: SortedSet[X], +C <: SortedSetOps[A, CC, C]]
3838
def flatMap[B : Ordering](f: A => IterableOnce[B]): CC[B] = sortedFromIterable(View.FlatMap(toIterable, f))
3939

4040
/** Zip. Interesting because it requires to align to source collections. */
41-
def zip[B](xs: Iterable[B])(implicit ev: Ordering[(A @uncheckedVariance, B)]): CC[(A @uncheckedVariance, B)] = // sound bcs of VarianceNote
42-
zipWith(xs)((_, _))(ev)
41+
def zip[B](that: Iterable[B])(implicit ev: Ordering[(A @uncheckedVariance, B)]): CC[(A @uncheckedVariance, B)] = // sound bcs of VarianceNote
42+
zipWith(that)((_, _))(ev)
4343

44-
def zipWith[B, R](xs: Iterable[B])(f: (A, B) => R)(implicit ev: Ordering[R]): CC[R] =
45-
sortedFromIterable(View.ZipWith(toIterable, xs, f))
44+
def zipWith[B, R](that: Iterable[B])(f: (A, B) => R)(implicit ev: Ordering[R]): CC[R] =
45+
sortedFromIterable(View.ZipWith(toIterable, that, f))
4646

4747
def collect[B: Ordering](pf: scala.PartialFunction[A, B]): CC[B] = flatMap(a =>
4848
if (pf.isDefinedAt(a)) View.Single(pf(a))

src/main/scala/strawman/collection/View.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ object View extends IterableFactory[View] {
184184
}
185185

186186
/** A view that generalizes the zip operation by applying a function to each pair of elements
187-
* in the underlying collection and another collection or iterator.
187+
* in the underlying collection and another collection.
188188
*/
189189
case class ZipWith[A, B, R](underlying: Iterable[A], other: Iterable[B], f: (A, B) => R) extends View[R] {
190190
def iterator() = underlying.iterator().zipWith(other)(f)

src/main/scala/strawman/collection/immutable/ImmutableArray.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ class ImmutableArray[+A] private[collection] (private val elements: scala.Array[
7676
ImmutableArray.fromIterable(View.Concat(xs, toIterable))
7777
}
7878

79-
override def zipWith[B, R](xs: collection.Iterable[B])(f: (A, B) => R): ImmutableArray[R] =
80-
xs match {
79+
override def zipWith[B, R](that: collection.Iterable[B])(f: (A, B) => R): ImmutableArray[R] =
80+
that match {
8181
case bs: ImmutableArray[B] =>
8282
ImmutableArray.tabulate(length min bs.length) { i =>
8383
f(apply(i), bs(i))
8484
}
8585
case _ =>
86-
ImmutableArray.fromIterable(View.ZipWith(toIterable, xs, f))
86+
ImmutableArray.fromIterable(View.ZipWith(toIterable, that, f))
8787
}
8888

8989
override def partition(p: A => Boolean): (ImmutableArray[A], ImmutableArray[A]) = {

src/main/scala/strawman/collection/immutable/LazyList.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ sealed abstract class LazyList[+A]
172172
else prefix.lazyAppendAll(nonEmptyPrefix.tail.flatMap(f))
173173
}
174174

175-
override final def zipWith[B, R](xs: collection.Iterable[B])(f: (A, B) => R): LazyList[R] =
176-
if (this.isEmpty || xs.isEmpty) LazyList.empty
177-
else LazyList.cons(f(this.head, xs.head), this.tail.zipWith(xs.tail)(f))
175+
override final def zipWith[B, R](that: collection.Iterable[B])(f: (A, B) => R): LazyList[R] =
176+
if (this.isEmpty || that.isEmpty) LazyList.empty
177+
else LazyList.cons(f(this.head, that.head), this.tail.zipWith(that.tail)(f))
178178

179179
override final def zipWithIndex: LazyList[(A, Int)] = this.zip(LazyList.from(0))
180180
}

test/junit/src/test/scala/strawman/collection/ArrayOpsTest.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ class ArrayOpsTest {
1414
val array: ArrayOps[Int] = Array(1, 2, 3)
1515
val result: Array[(Int, String)] = array.zip(List("a", "b", "c"))
1616

17-
assertArrayEquals(Array((1, "a"), (2, "b"), (3, "c")).asInstanceOf[Array[AnyRef]], result.asInstanceOf[Array[AnyRef]])
17+
assertTrue(result.sameElements(Array((1, "a"), (2, "b"), (3, "c"))))
1818
}
1919

2020
@Test
2121
def hasCorrectOverloadedZipWhenInputHasMoreElements: Unit = {
2222
val array: ArrayOps[Int] = Array(1, 2)
2323
val result: Array[(Int, String)] = array.zip(List("a", "b", "c"))
2424

25-
assertArrayEquals(Array((1, "a"), (2, "b")).asInstanceOf[Array[AnyRef]], result.asInstanceOf[Array[AnyRef]])
25+
assertTrue(result.sameElements(Array((1, "a"), (2, "b"))))
2626
}
2727

2828
@Test
2929
def hasCorrectOverloadedZipWhenInputHasLessElements: Unit = {
3030
val array: ArrayOps[Int] = Array(1, 2, 3)
3131
val result: Array[(Int, String)] = array.zip(List("a", "b"))
3232

33-
assertArrayEquals(Array((1, "a"), (2, "b")).asInstanceOf[Array[AnyRef]], result.asInstanceOf[Array[AnyRef]])
33+
assertTrue(result.sameElements(Array((1, "a"), (2, "b"))))
3434
}
3535

3636
@Test

0 commit comments

Comments
 (0)