[Home] Type Microsoft.FSharp.Collections.Map


Immutable maps. Keys are ordered by F# generic comparison. Maps based on generic comparison are efficient for small keys. They are not a suitable choice if keys are recursive data structures or if keys require bespoke comparison semantics.

Full Type Signature

[<SealedAttribute ()>]
type Map<'key,'a> =
  class
    interface IEnumerable
    interface IStructuralHash
    interface IComparable
    interface IEnumerable<KeyValuePair<'key,'a>>
    interface ICollection<KeyValuePair<'key,'a>>
    interface IDictionary<'key,'a>
    new : seq<'key * 'a> -> Map<'key,'a>
    member Add : 'key * 'a -> Map<'key,'a>
    member ContainsKey : 'key -> bool
    member Remove : 'key -> Map<'key,'a>
    member TryFind : 'key -> 'a option
    member Count : int
    member IsEmpty : bool
    member Item : 'key -> 'a with get
  end

Instance Members

MemberDescription
member Add : 'key * 'a -> Map<'key,'a>
Return a new map with the binding added to the given map.
member ContainsKey : 'key -> bool
Test is an element is in the domain of the map
member Count : int
The number of bindings in the map
override Equals : obj -> bool
member IsEmpty : bool
Return true if there are no bindings in the map.
member Item : 'key -> 'a with get
Lookup an element in the map. Raise KeyNotFoundException if no binding exists in the map.
member Remove : 'key -> Map<'key,'a>
Remove an element from the domain of the map. No exception is raised if the element is not present.
member TryFind : 'key -> 'a option
Lookup an element in the map, returning a Some value if the element is in the domain of the map and None if not.

Static Members

MemberDescription
new : seq<'key * 'a> -> Map<'key,'a>
Build a map that contains the bindings of the given IEnumerable

See Also

Microsoft.FSharp.Collections


Documentation for assembly FSharp.Core, version 1.9.6.0, generated using F# Programming Language version 1.9.6.0