@@ -67,7 +67,7 @@ public class ImperativeRandoms {
67
67
[7, 8, 9, 11, 13, 15, 18]
68
68
```
69
69
70
- 在 ` Randoms.java ` 中,我们无需定义任何变量,但在这里我们定义了 3 个变量: ` rand ` ,` rints ` 和 ` r ` 。由于 ` nextInt() ` 方法没有下标的原因(其内置的下标永远为 0),这段代码实现起来更复杂。所以我们要生成额外的值来过滤小于 5 的结果。
70
+ 在 ` Randoms.java ` 中,我们无需定义任何变量,但在这里我们定义了 3 个变量: ` rand ` ,` rints ` 和 ` r ` 。由于 ` nextInt() ` 方法没有下限的原因(其内置的下限永远为 0),这段代码实现起来更复杂。所以我们要生成额外的值来过滤小于 5 的结果。
71
71
72
72
** 注意** ,你必须要研究程序的真正意图,而在 ` Randoms.java ` 中,代码只是告诉了你它正在做什么。这种语义清晰性也是 Java 8 的流式编程更受推崇的重要原因。
73
73
@@ -189,15 +189,15 @@ public class RandomGenerators {
189
189
show(rand. ints(). boxed());
190
190
show(rand. longs(). boxed());
191
191
show(rand. doubles(). boxed());
192
- // 控制上标和下标 :
192
+ // 控制上限和下限 :
193
193
show(rand. ints(10 , 20 ). boxed());
194
194
show(rand. longs(50 , 100 ). boxed());
195
195
show(rand. doubles(20 , 30 ). boxed());
196
196
// 控制流大小:
197
197
show(rand. ints(2 ). boxed());
198
198
show(rand. longs(2 ). boxed());
199
199
show(rand. doubles(2 ). boxed());
200
- // 控制流的大小和角标
200
+ // 控制流的大小和界限
201
201
show(rand. ints(3 , 3 , 9 ). boxed());
202
202
show(rand. longs(3 , 12 , 22 ). boxed());
203
203
show(rand. doubles(3 , 11.5 , 12.3 ). boxed());
@@ -833,7 +833,7 @@ public class Prime {
833
833
467 479 487 491 499 503 509 521 523 541
834
834
```
835
835
836
- ` rangeClosed() ` 包含了上界值 。如果余数没有产生 0,则 ` noneMatch() ` 操作返回 ture,如果出现任何等于 0 的则返回 false。 ` noneMatch() ` 操作在第一次失败之后就会推出,而不是进行全部尝试。
836
+ ` rangeClosed() ` 包含了上限值 。如果余数没有产生 0,则 ` noneMatch() ` 操作返回 ture,如果出现任何等于 0 的则返回 false。 ` noneMatch() ` 操作在第一次失败之后就会推出,而不是进行全部尝试。
837
837
838
838
### 应用操作到所有元素
839
839
0 commit comments