Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDuplicate elements in ELists
https://www.eclipse.org/forums/index.php/mv/msg/1106575/1836702/#msg_1836702
I had some questions about ELists. Can they not have duplicate elements, and is there some way to circumvent this? I noticed this while utilizing the API for my grammar. In some cases, ELists may have duplicate items and in others they cannot accept duplicate items. Is there more information on how ELists work with duplicate elements? Thank you]]>Jonathan Eugenio2021-01-12T14:42:58-00:00Re: Duplicate elements in ELists
https://www.eclipse.org/forums/index.php/mv/msg/1106575/1836703/#msg_1836703
Quote:
Can they not have duplicate elements,
I suspect a confused negative.
The isUnique() API controls unique/not-unique.
If you use an Ecore model you will find that many-element collections have a unique and an ordered option. Explore Ecore to learn how the underlying capabilities work.
Regards
Ed Willink]]>Ed Willink2021-01-12T14:59:06-00:00Re: Duplicate elements in ELists
https://www.eclipse.org/forums/index.php/mv/msg/1106575/1836704/#msg_1836704
and what
value e.g org.eclipse.emf.common.util.AbstractEList.isUnique() has.
you may play around with a manual metamodel
]]>Christian Dietrich2021-01-12T15:01:31-00:00Re: Duplicate elements in ELists
https://www.eclipse.org/forums/index.php/mv/msg/1106575/1836770/#msg_1836770
I was able to solve the issue by using myElist.addUnique(EObject) instead of myElist.add(EObject). I appreciate
the help.]]>Jonathan Eugenio2021-01-13T14:44:45-00:00Re: Duplicate elements in ELists
https://www.eclipse.org/forums/index.php/mv/msg/1106575/1836777/#msg_1836777
This sounds very wrong. I have been using EMF for many years and AFAICR I have never needed to use addUnique(); add() works fine. In so far as it doesn't I suspect that you have a much more deep seated problem waiting to bite you when it can occur in a more obscure and intermittent fashion.