Dec. 23, 2009
9:55 p.m.
Stéphane Ducasse <stephane.ducasse@...> writes:
I was more looking at the user perspective. You often want an orderedCollection (add:) vs Array at: but which deals with duplicate as a Set.
A simple method should do that job Collection >> #addIfAbsent: element (self includes: element) ifFalse: [ self add: element ] usage coll := OrderedCollection new. coll addIfAbsent: #foo. coll addIfAbsent: #bar. coll addIfAbsent: #qux. coll addIfAbsent: #bar. self assert: coll asArray = #(foo bar qux). --AA