Skip to content

Commit 420f884

Browse files
authored
Update IsIterableOnce scaladoc (#24641)
- use `extension` and `using` instead of `implicit` - avoid postfix and infix
2 parents 2fc524a + 5753eba commit 420f884

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

library/src/scala/collection/generic/IsIterableOnce.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@ import caps.unsafe.untrackedCaptures
2727
*
2828
* Example usage,
2929
* {{{
30-
* class FilterMapImpl[Repr, I <: IsIterableOnce[Repr]](coll: Repr, it: I) {
31-
* final def filterMap[B, That](f: it.A => Option[B])(implicit bf: BuildFrom[Repr, B, That]): That = {
30+
* extension [Repr, I <: IsIterableOnce[Repr]](coll: Repr)(using it: I) {
31+
* final def filterMap[B, That](f: it.A => Option[B])(using bf: BuildFrom[Repr, B, That]): That = {
3232
* val b = bf.newBuilder(coll)
33-
* for(e <- it(coll).iterator) f(e) foreach (b +=)
33+
* for(e <- it(coll).iterator) f(e).foreach(b += _)
3434
* b.result()
3535
* }
3636
* }
37-
* implicit def filterMap[Repr](coll: Repr)(implicit it: IsIterableOnce[Repr]): FilterMapImpl[Repr, it.type] =
38-
* new FilterMapImpl(coll, it)
3937
*
40-
* List(1, 2, 3, 4, 5) filterMap (i => if(i % 2 == 0) Some(i) else None)
38+
* List(1, 2, 3, 4, 5).filterMap(i => if(i % 2 == 0) Some(i) else None)
4139
* // == List(2, 4)
4240
* }}}
4341
*/

0 commit comments

Comments
 (0)