|Re: How to populate a Map of List ? [message #941559 is a reply to message #941546]
||Fri, 12 October 2012 16:39
| Ed Merks
Registered: July 2009
On 12/10/2012 6:26 PM, David Michonneau wrote:
> I have modeled a map of <String,List> in my ecore based on the wiki
> (http://wiki.eclipse.org/EMF/FAQ#How_do_I_create_a_Map_in_EMF.3F), it
> has generated the code correctly, but now I don't see how to populate it.
> Indeed the map values are EList, and I didn't find any corresponding
> feature for it. How to create it?
> I get this method in the map impl class:
> public EMap<String, EList<MyClass>> getEMap()
> Now when I want to put something in it, I will do:
> a.put("key", value);
> the question is: how do I create an empty EList<MyClass> for value?
ECollections.emptyList(); a put will copy that into the value feature of
the map entry, essentially creating a map entry with an empty value
list. Or create a new BasicEList, populated it with MyClass instances
and use put("key", list), which will copy the list into the value
feature of the map entry.
Powered by FUDForum
. Page generated in 0.01407 seconds