So any call to retrieve a set, is always done using Collections.unmodifiableSet.
public Set<T> getCycles()
I would have been much more at ease, if we had also decided to make the elements of the set Immutable Objects, but alas, this is the status quo.
As it is right now, it's possible to change the attributes of the individual elements, and so break the constraints between them.
SurpriseImagine the surprise of my colleague, when, out of nowhere, he found the following method:
public abstract SortedSet<T> getAsModifableSet();
The typo in the name is actually in the code, I swear! My grasp of the intricacies of spelling is beyond reproach.
And it returns a very implementation-specific Set as well.
And it's public too.
I'm sure there are always good reasons for these things, but sometimes I'd like to run my head into a wall.