Login
|
Signup
langref.org
-
python
,
csharp
,
erlang
,
cpp
...
add..
all
clojure
fantom
fsharp
go
haskell
java
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 empty map
python
map = {}
map = {}
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)]).
cpp
C++/CLI .NET 2.0
Hashtable^ hash = gcnew Hashtable;
using namespace System;
using namespace System::Collections;
int main()
{
Hashtable^ hash = gcnew Hashtable;
}
cpp
C++/CLI .NET 2.0
Generic::Dictionary<String^, String^>^ dict = gcnew Generic::Dictionary<String^, String^>();
using namespace System;
using namespace System::Collections;
int main()
{
Generic::Dictionary<String^, String^>^ dict = gcnew Generic::Dictionary<String^, String^>();
}
cpp
std::map<int, std::string> m;
int main()
{
std::map<int, std::string> m;
}
groovy
def map = [:]
def map = [:]
groovy
Map map = new HashMap();
Map map = new HashMap();
Submit a new solution for
python
,
csharp
,
erlang
,
cpp
...
There are 17 other solutions in
additional
languages (
clojure
,
fantom
,
fsharp
,
go
...)