Scala:没有continue,break怎么办?
scala自身是没有continue,break这两个语法关键词的。
但是实际上我们还是很希望有这两个语法,那么我们是否可以自己实现呢?
- 从官网上搜索,我们可以找到一下关于break的类相关资料:
Breaks extends AnyRef
基础才是编程人员应该深入研究的问题,比如:
1)List/Set/Map内部组成原理|区别
2)mysql索引存储结构&如何调优/b-tree特点、计算复杂度及影响复杂度的因素。。。
3)JVM运行组成与原理及调优
4)Java类加载器运行原理
5)Java中GC过程原理|使用的回收算法原理
6)Redis中hash一致性实现及与hash其他区别
7)Java多线程、线程池开发、管理Lock与Synchroined区别
8)Spring IOC/AOP 原理;加载过程的。。。
【+加关注】。
A class that can be instantiated for the break control abstraction. Example usage:
Calls to break from one instantiation of
Breaks
will never target breakable objects of some other instantiation.输出结果
Hello World
hello1
hello2
hello3
hello4
hello5
the index is :6
hello7
hello8
hello9
hello10
Process finished with exit code 0
或者
输出结果
Hello World
hello1
hello2
hello3
hello4
hello5
the index is :6
参考资料:scala break & continue http://www.cnblogs.com/rollenholt/p/4119105.html