<!doctype html>
<title>CodeMirror: Scala mode</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../../doc/docs.css">
<link rel="stylesheet" href="../../lib/codemirror.css">
<link rel="stylesheet" href="../../theme/ambiance.css">
<script src="../../lib/codemirror.js"></script>
<script src="../../addon/edit/matchbrackets.js"></script>
<script src="clike.js"></script>
<div id=nav>
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
<ul>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror">Code</a>
</ul>
<ul>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">Scala</a>
</ul>
</div>
<article>
<h2>Scala mode</h2>
<form>
<textarea id="code" name="code">
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.collection
import generic._
import mutable.{ Builder, ListBuffer }
import annotation.{tailrec, migration, bridge}
import annotation.unchecked.{ uncheckedVariance => uV }
import parallel.ParIterable
/** A template trait for traversable collections of type `Traversable[A]`.
*
* $traversableInfo
* @define mutability
* @define traversableInfo
* This is a base trait of all kinds of $mutability Scala collections. It
* implements the behavior common to all collections, in terms of a method
* `foreach` with signature:
* {{{
* def foreach[U](f: Elem => U): Unit
* }}}
* Collection classes mixing in this trait provide a concrete
* `foreach` method which traverses all the
* elements contained in the collection, applying a given function to each.
* They also need to provide a method `newBuilder`
* which creates a builder for collections of the same kind.
*
* A traversable class might or might not have two properties: strictness
* and orderedness. Neither is represented as a type.
*
* The instances of a strict collection class have all their elements
* computed before they can be used as values. By contrast, instances of
* a non-strict collection class may defer computation of some of their
* elements until after the instance is available as a value.
* A typical example of a non-strict collection class is a
* <a href="../immutable/Stream.html" target="ContentFrame">
* `scala.collection.immutable.Stream`</a>.
* A more general class of examples are `TraversableViews`.
*
* If a collection is an instance of an ordered collection class, traversing
* its elements with `foreach` will always visit elements in the
* same order, even for different runs of the program. If the class is not
* ordered, `foreach` can visit elements in different orders for
* different runs (but it will keep the same order in the same run).'
*
* A typical example of a collection class which is not ordered is a
* `HashMap` of objects. The traversal order for hash maps will
* depend on the hash codes of its elements, and these hash codes might
* differ from one run to the next. By contrast, a `LinkedHashMap`
* is ordered because it's `foreach` method visits elements in the
* order they were inserted into the `HashMap`.
*
* @author Martin Odersky
* @version 2.8
* @since 2.8
* @tparam A the element type of the collection
* @tparam Repr the type of the actual collection containing the elements.
*
* @define Coll Traversable
* @define coll traversable collection
*/
trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr]
with FilterMonadic[A, Repr]
with TraversableOnce[A]
with GenTraversableLike[A, Repr]
with Parallelizable[A, ParIterable[A]]
{
self =>
import Traversable.breaks._
/** The type implementing this traversable */
protected type Self = Repr
/** The collection of type $coll underlying this `TraversableLike` object.
* By default this is implemented as the `TraversableLike` object itself,
* but this can be overridden.
*/
def repr: Repr = this.asInstanceOf[Repr]
/** The underlying collection seen as an instance of `$Coll`.
* By default this is implemented as the current collection object itself,
* but this can be overridden.
*/
protected[this] def thisCollection: Traversable[A] = this.asInstanceOf[Traversable[A]]
/** A conversion from collections of type `Repr` to `$Coll` objects.
* By default this is implemented as just a cast, but this can be overridden.
*/
protected[this] def toCollection(repr: Repr): Traversable[A] = repr.asInstanceOf[Traversable[A]]
/** Creates a new builder for this collection type.
*/
protected[this] def newBuilder: Builder[A, Repr]
protected[this] def parCombiner = ParIterable.newCombiner[A]
/** Applies a function `f` to all elements of this $coll.
*
* Note: this method underlies the implementation of most other bulk operations.
* It's important to implement this method in an efficient way.
*
*
* @param f the function that is applied for its side-effect to every element.
* The result of function `f` is discarded.
*
* @tparam U the type parameter describing the result of function `f`.
* This result will always be ignored. Typically `U` is `Unit`,
* but this is not necessary.
*
* @usecase def foreach(f: A => Unit): Unit
*/
def foreach[U](f: A => U): Unit
/** Tests whether this $coll is empty.
*
* @return `true` if the $coll contain no elements, `false` otherwise.
*/
def isEmpty: Boolean = {
var result = true
breakable {
for (x <- this) {
result = false
break
}
}
result
}
/** Tests whether this $coll is known to have a finite size.
* All strict collections are known to have finite size. For a non-strict collection
* such as `Stream`, the predicate returns `true` if all elements have been computed.
* It returns `false` if the stream is not yet evaluated to the end.
*
* Note: many collection methods will not work on collections of infinite sizes.
*
* @return `true` if this collection is known to have finite size, `false` otherwise.
*/
def hasDefiniteSize = true
def ++[B >: A, That](that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.seq.size)
b ++= thisCollection
b ++= that.seq
b.result
}
@bridge
def ++[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
++(that: GenTraversableOnce[B])(bf)
/** Concatenates this $coll with the elements of a traversable collection.
* It differs from ++ in that the right operand determines the type of the
* resulting collection rather than the left one.
*
* @param that the traversable to append.
* @tparam B the element type of the returned collection.
* @tparam That $thatinfo
* @param bf $bfinfo
* @return a new co
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松copy复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全栈开发),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助 【资源内容】:项目具体内容可查看/点击本页面下方的*资源详情*,包含完整源码+工程文件+说明(若有)等。【若无积分,此资源可私信获取】 【本人专注计算机领域】:有任何使用问题欢迎随时与我联系,我会及时解答,第一时间为您提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【适合场景】:相关项目设计中,皆可应用在项目开发、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面中 可借鉴此优质项目实现复刻,也可基于此项目来扩展开发出更多功能 #注 1. 本资源仅用于开源学习和技术交流。不可商用等,一切后果由使用者承担 2. 部分字体及插图等来自网络,若是侵权请联系删除,本人不对所涉及的版权问题或内容负法律责任。收取的费用仅用于收集和整理资料耗费时间的酬劳
资源推荐
资源详情
资源评论
收起资源包目录
个人博客页面,不代表最终版本,为SSH项目 .zip (1089个子文件)
AUTHORS 6KB
AUTHORS 6KB
Blog.class 11KB
BlogServiceImpl.class 7KB
Comment.class 6KB
User.class 6KB
BlogController.class 6KB
TypeController.class 5KB
TagController.class 5KB
TagServieceImpl.class 4KB
CommentServiceImpl.class 4KB
TypeServiceImpl.class 4KB
BlogServiceImpl$1.class 4KB
IndexController.class 4KB
LogAspect.class 3KB
CommentController.class 3KB
Tag.class 3KB
BlogServiceImpl$2.class 3KB
Type.class 3KB
ShowTypeController.class 3KB
MarkDownUtils.class 2KB
LoginController.class 2KB
ShowTagsController.class 2KB
BlogRepository.class 2KB
BlogQuery.class 2KB
BlogServiceImpl$3.class 2KB
ControllerExceptionHandler.class 2KB
BlogService.class 2KB
MD5Utils.class 2KB
MyBeanUtils.class 2KB
WebConfig.class 1KB
archivesController.class 1KB
LogAspect$RequestLog.class 1KB
MarkDownUtils$CustomAttributeProvider.class 1KB
ShowAboutMeController.class 1KB
LoginInterceptor.class 1KB
BlogApplication.class 1KB
TagService.class 1KB
UserServiceImpl.class 1003B
TypeService.class 987B
MarkDownUtils$1.class 887B
NotFoundException.class 832B
TypeRepository.class 732B
TagRepository.class 726B
CommentRepository.class 591B
BlogApplicationTests.class 523B
UserRepository.class 467B
CommentService.class 398B
UserService.class 336B
editormd.css 76KB
editormd.css 76KB
animate.css 76KB
animate.css 76KB
editormd.min.css 60KB
editormd.min.css 60KB
editormd.preview.css 55KB
editormd.preview.css 55KB
editormd.preview.min.css 44KB
editormd.preview.min.css 44KB
ambiance.css 26KB
ambiance.css 26KB
typo.css 8KB
typo.css 8KB
codemirror.css 8KB
codemirror.css 8KB
codemirror.min.css 5KB
codemirror.min.css 5KB
mdn-like.css 5KB
mdn-like.css 5KB
solarized.css 5KB
solarized.css 5KB
custom.css 4KB
custom.css 4KB
merge.css 3KB
merge.css 3KB
lint.css 3KB
lint.css 3KB
xq-dark.css 3KB
xq-dark.css 3KB
lesser-dark.css 2KB
lesser-dark.css 2KB
pastel-on-dark.css 2KB
pastel-on-dark.css 2KB
xq-light.css 2KB
xq-light.css 2KB
tomorrow-night-eighties.css 2KB
tomorrow-night-eighties.css 2KB
editormd.logo.css 2KB
editormd.logo.css 2KB
erlang-dark.css 2KB
erlang-dark.css 2KB
zenburn.css 2KB
zenburn.css 2KB
prism.css 2KB
prism.css 2KB
twilight.css 2KB
twilight.css 2KB
midnight.css 2KB
midnight.css 2KB
vibrant-ink.css 2KB
共 1089 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
热爱技术。
- 粉丝: 2521
- 资源: 7862
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Microsoft-Office-2019-VL-Serializer-Universal office使用软件
- 三张卡牌类游戏demo
- (源码)基于Arduino的指纹识别与RFID读卡器访问控制系统.zip
- (源码)基于SpringCloud的新闻检索与推荐系统.zip
- (源码)基于C语言和C++的简单网站留言评论系统.zip
- (源码)基于Apache Mina框架的短信通信系统.zip
- 前端铺子开发者 前端杂货铺 小程序在线课堂+工具组件小程序uniapp移动端.zip
- Delphi TImage 增加支持 PNG 图片格式 TPNGImage
- (源码)基于C#的图书馆管理系统.zip
- (源码)基于Java和Bukkit框架的年龄管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功