eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'AutoResizingOrderedCollectionWithDefault':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: AutoResizingOrderedCollectionWithDefault


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--OrderedCollection
            |
            +--AutoResizingOrderedCollection
               |
               +--AutoResizingOrderedCollectionWithDefault

Package:
stx:libbasic2
Category:
Collections-Sequenceable
Version:
rev: 1.5 date: 2021/01/20 13:10:28
user: cg
file: AutoResizingOrderedCollectionWithDefault.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Description:


I am an ordered collection which automatically resizes if elements
are added beyond the size. 
I.e. if #at:put: is sent for indexes > the current size, the receiver grows to
the required index and missing fields are implicitly filled with a default value.
Queries for non-existing elements are anwered with the default value.

copyright

COPYRIGHT (c) 2016 by Claus Gittinger / eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Instance protocol:

accessing
o  at: index
fetch an object at index.
If index is beyond the actual size, return the default value
(i.e. this is an alias for at:index ifAbsent:[default value])

o  at: index put: anObject
store an object at index.
If required, grow the receiver to ensure that index is valid

initialization
o  setDefaultValue: v


Examples:


|coll|

coll := AutoResizingOrderedCollectionWithDefault newWithDefaultValue:99.
coll at:4 put:'four'.
coll at:8 put:'eight'.
coll at:9


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 27 Jul 2024 08:13:12 GMT