質問

I am looking for keeping the order of my entries in the map based on the insertion order. So basically I am looking for creating a LinkedHashMap in my ecore model.

I need to persist this map, hence I'd like to use the serialization and proxy resolution feature of EMap. I tried to cast a LinkedHashMap to EcoreEmap by ((EMap.InternalMapView)myLinkedHashMap).eMap(); but that didn't work.

I can think of having a list and map together, and keep the order in list, but I'd really like to avoid duplication of reference, since these two can get out of sync.

Do you have any suggestions?

役に立ちましたか?

解決

If we use EMF EMap class, the insertion order will be kept and we wouldn't need a LinkeHashMap. More details are discussed here:

http://www.eclipse.org/forums/index.php/mv/tree/451092/1003801/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top