Login
|
Signup
langref.org
-
ruby
,
csharp
,
fantom
,
clojure
...
add..
all
cpp
erlang
fsharp
go
haskell
java
ocaml
perl
php
python
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Maps
Declaration
Define an unmodifiable empty map
ruby
map = {}.freeze
map = {}.freeze
fantom
map := [:].ro
class SolutionXX
{
Void main()
{
map := [:].ro
}
}
clojure
; Clojure maps are immutable
(def m {})
; Clojure maps are immutable
(def m {})
groovy
empty = Collections.EMPTY_MAP
empty = Collections.EMPTY_MAP
groovy
map = [:].asImmutable()
map = [:].asImmutable()
groovy
with commons collections
def empty = MapUtils.EMPTY_SORTED_MAP
import org.apache.commons.collections.MapUtils
def empty = MapUtils.EMPTY_SORTED_MAP
groovy
with google collections
def empty = ImmutableMap.of()
import com.google.common.collect.ImmutableMap
def empty = ImmutableMap.of()
Submit a new solution for
ruby
,
csharp
,
fantom
,
clojure
...
There are 14 other solutions in
additional
languages (
cpp
,
erlang
,
fsharp
,
haskell
...)