문제

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