石橋秀仁(zerobase)書き散らす

まじめなブログは別にあります→ja.ishibashihideto.net

Smalltalk Standard Colletion Protocols

Pharo by Example Figure 9.2: Standard Collection protocols

Accessing

  • size
  • capacity
  • at: anIndex
  • at: anIndex put: anElement

Testing

  • isEmpty
  • includes: anElement
  • contains: aBlock
  • occurrencesOf: anElement

Adding

  • add: anElement
  • addAll: aCollection

Removing

  • remove: anElement
  • remove: anElement ifAbsent: aBlock
  • removeAll: aCollection

Enumerating

  • do: aBlock
  • collect: aBlock
  • select: aBlock
  • reject: aBlock
  • detect: aBlock
  • detect: aBlock ifNone: aNoneBlock
  • inject: aValue into: aBinaryBlock

Converting

  • asBag
  • asSet
  • asOrderedCollection
  • asSortedCollection
  • asArray
  • asSortedCollection: aBlock

Creation

  • with: anElement
  • with:with:
  • with:with:with:
  • with:with:with:with:
  • withAll: aCollection