Scala 官方文档 --包结构解读

来源:互联网 发布:flyme解锁软件 编辑:程序博客网 时间:2024/06/07 02:34

scala 官方文档 (英文版)

root (This is the documentation for the Scala standard library.)

Package structure

The scala package contains core types like Int, Float, Array or Option
which are accessible in all Scala compilation units without explicit
qualification or imports.

Notable packages include:

scala.collection and its sub-packages contain Scala’s collections
framework scala.collection.immutable - Immutable, sequential
data-structures such as Vector, List, Range, HashMap or HashSet
scala.collection.mutable - Mutable, sequential data-structures such as
ArrayBuffer, StringBuilder, HashMap or HashSet
scala.collection.concurrent - Mutable, concurrent data-structures such
as TrieMap scala.collection.parallel.immutable - Immutable, parallel
data-structures such as ParVector, ParRange, ParHashMap or ParHashSet
scala.collection.parallel.mutable - Mutable, parallel data-structures
such as ParArray, ParHashMap, ParTrieMap or ParHashSet
scala.concurrent - Primitives for concurrent programming such as
Futures and Promises scala.io - Input and output operations scala.math
- Basic math functions and additional numeric types like BigInt and BigDecimal scala.sys - Interaction with other processes and the
operating system scala.util.matching - Regular expressions Other
packages exist. See the complete list on the right.

Additional parts of the standard library are shipped as separate
libraries. These include:

scala.reflect - Scala’s reflection API (scala-reflect.jar) scala.xml -
XML parsing, manipulation, and serialization (scala-xml.jar)
scala.swing - A convenient wrapper around Java’s GUI framework called
Swing (scala-swing.jar) scala.util.parsing - Parser combinators
(scala-parser-combinators.jar) Automatic imports

Identifiers in the scala package and the scala.Predef object are
always in scope by default.

Some of these identifiers are type aliases provided as shortcuts to
commonly used classes. For example, List is an alias for
scala.collection.immutable.List.

Other aliases refer to classes provided by the underlying platform.
For example, on the JVM, String is an alias for java.lang.String.

部分中文翻译版:

package root(scala 根包)——这是Scala 标准库文档
Package structure(包 结构):
注意:Int Float Array 或者 option 核心类型 无需 在程序中特意声明或者引入(import),因为 在所有Scala程序编译器中都包含该核心类库

需要声明引入的包:

1.scala.collection (该包和其子包 包含了 Scala 集合框架)

scala.collection.immutable —— 不可变的顺序数据结构,如Vector,List,Range,HashMap或HashSetscala.collection.mutable —— 可变的顺序数据结构,如ArrayBuffer,StringBuilder,HashMap或HashSetscala.collection.concurrent —— 可变的并发数据结构,如TrieMapscala.collection.parallel.immutable —— 不可变的并行数据结构,如ParVector,ParRange,ParHashMap或ParHashSetscala.collection.parallel.mutable —— 可变的并行数据结构,如ParArray,ParHashMap,ParTrieMap或ParHashSet

2.scala.concurrent—— 并行编程的基础类例如 Futures 和 Promises

3.scala.io —— 输入和输出操作
4.scala.math—— 基本数学函数和附加数字类型,如BigInt和BigDecimal
5.scala.sys —— 与其他进程和操作系统进行交互
6.scala.util.matching ——常规操作包

0 0