コレクションの言語
コレクションのサポートを追加する Base Language の拡張。
Collection language provides a set of abstractions that enable the use of a few most commonly used containers, as well as a set of powerful tools to construct queries: The fundamental type provided by the collections is sequence
, which is an abstraction analogous to Iterable in Java, or IEnumerable in .NET . The containers include list
(both array-based and linked list), set
and map
. The collections language also provides the means to build expressive queries using closures, in a way similar to what LINQ(英語) does.
コレクション言語には、null 要素と null シーケンスに関する一連の緩和された規則があります。
NULL シーケンスはまだシーケンスです
Null
は、シーケンス変数に割り当てることができる完全に受け入れられた値です。これは単に空のシーケンスになります。
例外をスローする代わりに null が返される
標準コレクションフレームワークは、正常に完了できないメソッドを呼び出した結果として例外をスローする必要がありますが、コレクション言語のシーケンスとそのサブタイプは null
値を返します。例: 空のシーケンスに対して first
操作を呼び出すと、例外をスローする代わりに null
値が返されます。
skip
selectMany
または forEach
クロージャー内に適用可能です。 skip
ステートメントの効果は、現在の入力要素の処理が停止し、次の要素(利用可能な場合)がすぐに選択されることです。
停止
selectMany
クロージャーまたはシーケンスイニシャライザークロージャー内に適用可能です。stop ステートメントは、出力シーケンスの構成を即時に終了させ、入力シーケンス内の残りのすべての要素(存在する場合)を無視します。