From f8493aaea41b3051c8bf38f3950e52cf5958f02f Mon Sep 17 00:00:00 2001 From: Carl Ekerot Date: Wed, 28 Sep 2016 09:34:23 +0200 Subject: [PATCH] Correct return type for Iterator in lazyMap example of Views section The function in the example maps a function T => U on the given Iterable of type T, and should return an Iterable of type U. --- ja/overviews/collections/views.md | 2 +- overviews/collections/views.md | 2 +- zh-cn/overviews/collections/views.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ja/overviews/collections/views.md b/ja/overviews/collections/views.md index 8ffd3ef49b..c767133652 100644 --- a/ja/overviews/collections/views.md +++ b/ja/overviews/collections/views.md @@ -16,7 +16,7 @@ language: ja 非正格な変換演算子の具体例として、以下の遅延 map 演算の実装を見てほしい: - def lazyMap[T, U](coll: Iterable[T], f: T => U) = new Iterable[T] { + def lazyMap[T, U](coll: Iterable[T], f: T => U) = new Iterable[U] { def iterator = coll.iterator map f } diff --git a/overviews/collections/views.md b/overviews/collections/views.md index 24c57b1419..b53645a5e9 100644 --- a/overviews/collections/views.md +++ b/overviews/collections/views.md @@ -15,7 +15,7 @@ There are two principal ways to implement transformers. One is _strict_, that is As an example of a non-strict transformer consider the following implementation of a lazy map operation: - def lazyMap[T, U](coll: Iterable[T], f: T => U) = new Iterable[T] { + def lazyMap[T, U](coll: Iterable[T], f: T => U) = new Iterable[U] { def iterator = coll.iterator map f } diff --git a/zh-cn/overviews/collections/views.md b/zh-cn/overviews/collections/views.md index d32a3cf58d..c7a947e6fa 100644 --- a/zh-cn/overviews/collections/views.md +++ b/zh-cn/overviews/collections/views.md @@ -15,7 +15,7 @@ language: zh-cn 作为一个松弛法转换器的例子,分析下面的 lazy map操作: - def lazyMap[T, U](coll: Iterable[T], f: T => U) = new Iterable[T] { + def lazyMap[T, U](coll: Iterable[T], f: T => U) = new Iterable[U] { def iterator = coll.iterator map f }