As software developers we use datastructures all the time Linked Lists
, Hash Maps
, Stacks
. Most datastructures have a set of related operations that we can think of as the core pieces that define that structure in Scala we call the collection of those operations a Trait on in Java an Interface. A Hash Map
exposes the Map interface and has an operations to add a key and value +
, remove a key -
, retrieve the value at key get
and an operation like fold
to operate over the List of keys and values.
We have certain expectations of these datastructures from our experiences, we expect Maps to be hash maps, and we expect queues to be stacks. But there's no law that requires that. A common replacement of as Hash Map is a Tuple List,