Login
|
Signup
langref.org
-
java
and
erlang
add..
all
clojure
cpp
csharp
fantom
fsharp
go
groovy
haskell
ocaml
perl
php
python
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 empty map
java
Map map = new HashMap();
public class Solution10 {
public static void main(String[] args) {
Map map = new HashMap();
}
}
erlang
Map = dict:new(),
-module(emptymap).
-export([start/0]).
start() ->
Map = dict:new(),
io:format("~B~n", [dict:size(Map)]).
erlang
Map = orddict:new(),
-module(emptymap).
-export([start/0]).
start() ->
Map = orddict:new(),
io:format("~B~n", [orddict:size(Map)]).
erlang
Map = gb_trees:empty(),
-module(emptymap).
-export([start/0]).
start() ->
Map = gb_trees:empty(),
io:format("~B~n", [gb_trees:size(Map)]).
erlang
Map = ets:new(the_map_name, [set, private, {keypos, 1}]),
-module(emptymap).
-export([start/0]).
start() ->
Map = ets:new(the_map_name, [set, private, {keypos, 1}]),
io:format("~B~n", [ets:info(Map, size)]).
Submit a new solution for
java
or
erlang
There are 22 other solutions in
additional
languages (
clojure
,
cpp
,
fantom
,
fsharp
...)