Learn Scala Programming
上QQ阅读APP看书,第一时间看更新

SeqMap

SeqMap is a generic abstraction for ordered immutable maps. SeqMap itself exists in mutable and immutable forms. These forms have few different implementations:

  • The immutable ListMap implements immutable maps using a list-based data structure. The methods traversing ListMap visit its elements in the order they were inserted.
  • The mutable ListMap is a simple mutable map backed by a list. It preserves insertion order as its immutable sibling does.
  • VectorMap exists only in immutable form. It is implemented using a vector/map-based data structure and preserves insertion order. It has constant lookup but slower other operations.
  • LinkedHashMap is a mutable map whose implementation is based on a hashtable and preserves the insertion order if iterated over.