I know that OOP is not asking a object what it is but I have to flatten a array so I did this :
flattenArray: aCollection
^ (OrderedCollection
streamContents: [ :stream | self flatten: aCollection into: stream ])
asArray
flatten: anObject into: result
^ anObject isCollection
ifTrue: [ anObject do: [ :item | self flatten: item into: result ] ]
ifFalse: [ anObject ifNotNil: [ result nextPut: anObject ] ]
The name flattenArray is given bij exercism.
Now I wonder how I can make this more a OOP solution.
Can someone give me some hints or some examples ?
Roelof