View Problem

Define an unmodifiable empty map

DiskEdit
ruby
map = {}.freeze
DiskEdit
cpp
const std::map<T1,T2> immutable_map_instance_of_type_t1_to_t2;
ExpandDiskEdit
fsharp
// Most native fsharp data structures are immutable - updating a 'map' sees a modified copy created
let map = Map.empty
DiskEdit
groovy
empty = Collections.EMPTY_MAP
DiskEdit
groovy
map = [:].asImmutable()
ExpandDiskEdit
groovy with commons collections
def empty = MapUtils.EMPTY_SORTED_MAP
ExpandDiskEdit
groovy with google collections
def empty = ImmutableMap.of()
DiskEdit
haskell
import qualified Data.Map as Map

output :: Map.Map k v
output = Map.empty

Submit a new solution for ruby, cpp, fsharp, groovy ...
There are 13 other solutions in additional languages (clojure, erlang, fantom, java ...)