Login
|
Signup
langref.org
-
ruby
,
cpp
,
fsharp
,
erlang
...
add..
all
clojure
fantom
go
groovy
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 empty map
ruby
map = {}
map = {}
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;
}
fsharp
let map = Map.empty
#light
open System
open System.Collections
let map = Map.empty
fsharp
let map = new Generic.Dictionary<string, string>()
#light
open System
open System.Collections
let map = new Generic.Dictionary<string, string>()
fsharp
let map = new Hashtable()
#light
open System
open System.Collections
let map = new Hashtable()
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
ruby
,
cpp
,
fsharp
,
erlang
...
There are 16 other solutions in
additional
languages (
clojure
,
fantom
,
go
,
groovy
...)