OrderedCollection>>add:beforeIndex: yields an error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

OrderedCollection>>add:beforeIndex: yields an error

Wouter Gazendam
Hi,

When using #add:beforeIndex: on a sufficiently large OrderedCollection
yields an error when index > size.

Example:
| oc |
oc := (Array new: 80 withAll: #foo) asOrderedCollection.
oc add: #bar beforeIndex: 100

Calling #changeCapacityTo: beforehand seems to fix the problem:

| oc | (Array new: 80 withAll: #foo) asOrderedCollection.
oc changeCapacityTo: 100.
oc add: #bar beforeIndex: 100

Cheers,

Wouter
Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollection>>add:beforeIndex: yields an error

Alan Knight-2
Thanks. I've created AR 50227 for this.

At 11:09 AM 1/31/2006, Wouter Gazendam wrote:
>Hi, When using #add:beforeIndex: on a sufficiently large OrderedCollection yields an error when index > size. Example: | oc | oc := (Array new: 80 withAll: #foo) asOrderedCollection. oc add: #bar beforeIndex: 100 Calling #changeCapacityTo: beforehand seems to fix the problem: | oc | (Array new: 80 withAll: #foo) asOrderedCollection. oc changeCapacityTo: 100. oc add: #bar beforeIndex: 100 Cheers, Wouter

--
Alan Knight [|], Cincom Smalltalk Development
[hidden email]
[hidden email]
http://www.cincom.com/smalltalk

"The Static Typing Philosophy: Make it fast. Make it right. Make it run." - Niall Ross