this is my second MPS post here, but I am still new in MPS. I noticed a stranged behaviour using the method "subList".
I have a node<GoalRule> rule and I created a new node called node<GoalRule> newRule. I want to copy some information of rule and add it to newRule. rule has a list of innerElements called inner and I want to add a subList of this list to newRule. It looks like this:
I know that Java subList only returns a view of the portion of a list and so I expected the same behaviour. But in this case, the elements, which are in the subList, are deleted.
rule.inner = [input x, input y]
rule.inner.subList(0,0) = input x
newRule.inner = input x (thats correct)
rule.inner = [input y] (first element is deleted)
Should subList in MPS work like this or what is my mistake? If the bevaiour is correct, I want to understand it works like this.
I hope someone can help me.