Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Map initialization(Syntax for initializing a map with key/value pairs)
Map initialization [message #1850194] Mon, 21 February 2022 10:32 Go to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 152
Registered: July 2014
Senior Member
I cannot find the appropriate syntax for initializing a map with some values.

I tried

var myMap (String, String) = Map {("x", "y")};
and
var myMap (String, String) = Map {{"x", "y"}};

But both are rejected. How shall I do it?

Thanks.


Yves
Re: Map initialization [message #1850195 is a reply to message #1850194] Mon, 21 February 2022 10:36 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Yves

The following syntax is supported for initalising maps as per [1]

var myMap = Map{"a" = 1, "b" = 2};


Best,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/eol/#literal-values
Re: Map initialization [message #1850197 is a reply to message #1850195] Mon, 21 February 2022 12:48 Go to previous message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 152
Registered: July 2014
Senior Member
OK!
Sorry, I missed that part of the documentation.

Thanks!


Yves
Previous Topic:epsilon.emf.loadRegisteredMetamodel has no effect in Antrunner
Next Topic:Issue with Epsilon on Eclipse 2021-12
Goto Forum:
  


Current Time: Sat Apr 27 10:19:01 GMT 2024

Powered by FUDForum. Page generated in 0.03311 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top