How to create a set of nodes with specified equals method
Hey,
I want to create a set of specified nodes in a behavior method. Since sets do not allow multiple equal elements there must be some equals check inside the add method. Different nodes with the same name (from IValidIdentifier) should be considered as equal in my case.
In pure java I would override the equals method or implement the comparable interface, but I don't know how to handle this with nodes.
I want to create a set of specified nodes in a behavior method. Since sets do not allow multiple equal elements there must be some equals check inside the add method. Different nodes with the same name (from IValidIdentifier) should be considered as equal in my case.
In pure java I would override the equals method or implement the comparable interface, but I don't know how to handle this with nodes.
Please sign in to leave a comment.
set<node<INamedConcept>> set = new treeset({node<INamedConcept> a, node<INamedConcept> b => a.name.compareTo(b.name); });