This method of doing things is necessarily making CardinalityNodeList mutable. I'm not sure if it matters, but if you had spec.getNodes(), and accumulated them up into a list in this for loop, you could then build a CardinalityNodeList out of the list of Nodes and have it all be immutable.