Login
|
Signup
langref.org
-
python
,
clojure
,
fsharp
,
fantom
...
add..
all
cpp
csharp
erlang
go
groovy
haskell
ocaml
perl
php
ruby
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
python
2.6
import collections
EmptyDict = collections.namedtuple("EmptyDict", "")
e = EmptyDict()
import collections
EmptyDict = collections.namedtuple("EmptyDict", "")
e = EmptyDict()
clojure
; Clojure maps are immutable
(def m {})
; Clojure maps are immutable
(def m {})
fsharp
// Most native fsharp data structures are immutable - updating a 'map' sees a modified copy created
let map = Map.empty
#light
open System
open System.Collections
// Most native fsharp data structures are immutable - updating a 'map' sees a modified copy created
let map = Map.empty
fantom
map := [:].ro
class SolutionXX
{
Void main()
{
map := [:].ro
}
}
java
Map empty = Collections.EMPTY_MAP;
public class Solution11 {
public static void main(String[] args) {
Map empty = Collections.EMPTY_MAP;
}
}
java
org.apache.commons
SortedMap empty = MapUtils.EMPTY_SORTED_MAP;
import org.apache.commons.collections.MapUtils;
public class SolutionXX {
public static void main(String[] args) {
SortedMap empty = MapUtils.EMPTY_SORTED_MAP;
}
}
Submit a new solution for
python
,
clojure
,
fsharp
,
fantom
...
There are 15 other solutions in
additional
languages (
cpp
,
erlang
,
groovy
,
haskell
...)