linkedhashmap-0.1.0.0: Persistent LinkedHashMap data structure

Safe HaskellNone
LanguageHaskell2010

Data.LinkedHashMap.IntMap

Contents

Synopsis

Documentation

data LinkedHashMap k v Source

Constructors

LinkedHashMap (HashMap k (Entry v)) (IntMap (k, v)) (IORef Int) 

Instances

(Show k, Show v) => Show (LinkedHashMap k v) 
(NFData k, NFData v) => NFData (LinkedHashMap k v) 

Construction

empty :: LinkedHashMap k v Source

O(1) Construct an empty map.

singleton :: (Eq k, Hashable k) => k -> v -> LinkedHashMap k v Source

O(1) Construct a map with a single element.

Basic interface

null :: LinkedHashMap k v -> Bool Source

O(1) Return True if this map is empty, False otherwise.

size :: LinkedHashMap k v -> Int Source

O(1) Return the number of key-value mappings in this map.

member :: (Eq k, Hashable k) => k -> LinkedHashMap k a -> Bool Source

O(log n) Return True if the specified key is present in the map, False otherwise.

lookup :: (Eq k, Hashable k) => k -> LinkedHashMap k v -> Maybe v Source

O(log n) Return the value to which the specified key is mapped, or Nothing if this map contains no mapping for the key.

lookupDefault Source

Arguments

:: (Eq k, Hashable k) 
=> v

Default value to return.

-> k 
-> LinkedHashMap k v 
-> v 

O(log n) Return the value to which the specified key is mapped, or the default value if this map contains no mapping for the key.

(!) :: (Eq k, Hashable k) => LinkedHashMap k v -> k -> v Source

O(log n) Return the value to which the specified key is mapped. Calls error if this map contains no mapping for the key.

insert :: (Eq k, Hashable k) => k -> v -> LinkedHashMap k v -> LinkedHashMap k v Source

O(log n) Associate the specified value with the specified key in this map. If this map previously contained a mapping for the key, the old value is replaced.

delete :: (Eq k, Hashable k) => k -> LinkedHashMap k v -> LinkedHashMap k v Source

O(log n) Remove the mapping for the specified key from this map if present.

Combine

Union

Transformations

map :: (a -> b) -> [a] -> [b]

map f xs is the list obtained by applying f to each element of xs, i.e.,

map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
map f [x1, x2, ...] == [f x1, f x2, ...]

Difference and intersection

Folds

Filter

Conversions

keys :: (Eq k, Hashable k) => LinkedHashMap k v -> [k] Source

O(n) Return a list of this map's keys. The list is produced lazily.

elems :: (Eq k, Hashable k) => LinkedHashMap k v -> [v] Source

O(n) Return a list of this map's values. The list is produced lazily.

Lists

toList :: LinkedHashMap k v -> [(k, v)] Source

O(n) Return a list of this map's elements.

fromList :: (Eq k, Hashable k) => [(k, v)] -> LinkedHashMap k v Source

O(n*log n) Construct a map with the supplied mappings. If the list contains duplicate mappings, the later mappings take precedence.