Share via


Collections.Map<'Key,'Value> クラス (F#)

変更できないマップ。キーは、F# の汎用的な比較によって並べ替えられます。

名前空間/モジュール パス: Microsoft.FSharp.Collections

アセンブリ: FSharp.Core (FSharp.Core.dll 内)

[<Sealed>]
type Map<[<EqualityConditionalOnAttribute>] 'Key,[<ComparisonConditionalOnAttribute>] [<EqualityConditionalOnAttribute>] 'Value (requires comparison)> =
 class
  interface IEnumerable
  interface IComparable
  interface IEnumerable
  interface ICollection
  interface IDictionary
  new Map : seq<'Key * 'Value> -> Map< 'Key, 'Value>
  member this.Add : 'Key * 'Value -> Map<'Key, 'Value>
  member this.ContainsKey : 'Key -> bool
  member this.Remove : 'Key -> Map<'Key, 'Value>
  member this.TryFind : 'Key -> 'Value option
  member this.Count :  int
  member this.IsEmpty :  bool
  member this.Item ('Key) : 'Value
 end

解説

一般的な比較に基づくマップは、小さいキーの場合に効率的です。キーが再帰的なデータ構造の場合、またはキーが特別な比較セマンティクスを必要とする場合には適していません。このクラスのメンバーはすべてスレッド セーフであり、複数のスレッドから同時に使用できます。

この型は、コンパイルされたアセンブリでは FSharpMap という名前です。F# 以外の言語、またはリフレクションを使用してこの型にアクセスする場合は、この名前を使用します。

コンストラクター

メンバー

説明

new

指定した IEnumerable<T> の束縛を含むマップを作成します。

インスタンス メンバー

メンバー

説明

追加

指定されたマップに束縛を追加した新しいマップを返します。

ContainsKey

要素がマップのドメイン内に存在するかどうかをテストします。

[カウント]

マップ内の束縛の数。

IsEmpty

マップ内に束縛がない場合に true を返します。

項目

マップ内の要素を検索します。マップ内に束縛が存在しない場合は KeyNotFoundException を発生させます。

[削除]

マップのドメインから要素を削除します。要素が存在しない場合でも、例外は発生しません。

TryFind

マップ内の要素を検索し、要素がマップのドメイン内にある場合は Some 値を返し、そうでない場合は None を返します。

プラットフォーム

Windows 8、Windows 7、Windows Server 2012 で Windows Server 2008 R2

バージョン情報

F# コア ライブラリのバージョン

サポート: ポータブル 2.0、4.0

参照

関連項目

Microsoft.FSharp.Collections 名前空間 (F#)