These same protocols are supported by many different types of collections.
The following table describes protocols supported by CLDT collection classes.
after:, at:, basicAt:, before:, findFirst:, findLast:, first, indexOf:, indexOf:ifAbsent:, indexOfSubCollection:startingAt:, indexOfSubCollection:startingAt:ifAbsent:, last
Porting tip: | Smalltalk/V does not support indexOfSubCollection:startingAt: or indexOfSubCollection:startingAt:ifAbsent:. |
add:, addAll:
byteAt:, byteAt:put:
Porting tip: | Smalltalk/V does not support byteAt: and byteAt:put:. |
asArray, asBag, asByteArray, asOrderedCollection, asSet, asSortedCollection, asSortedCollection:
,, copyFrom:to:, copyReplaceAll:with:, copyReplaceFrom:to:with:, copyReplaceFrom:to:withObject:, copyReplacing:withObject:, copyWith:, copyWithout:, reverse
Note: | copyReplaceFrom:to:withObject: and copyReplacing:withObject: are not in the Blue Book, but we have found them to be useful. |
Porting tip: | Smalltalk/V does not support the following:
Objectworks/Smalltalk does not support the following:
Smalltalk/V uses reversed instead of reverse. Smalltalk/V uses different semantics for copyWithout:. In Smalltalk/V, only the first element equal to the argument is omitted from the copy, while in IBM Smalltalk (all platforms) and Objectworks\Smalltalk, all elements equal to the argument are left out. |
new, new:, with:, with:with:, with:with:with:, with:with:with:with:
new, new:
add:, addAll:, associationAt:, associationAt:ifAbsent:, at:, at:ifAbsent:, at:ifAbsentPut:, at:ifPresent:, at:put:, includesKey:, keyAtValue:, keyAtValue:ifAbsent:, keys, removeAllKeys:, removeAllKeys:ifAbsent:, removeKey:, removeKey:ifAbsent:, values
Note: | Several messages in this protocol have the same names as messages in other protocols but have different semantics: add:, addAll:, at:, and at:put:. The use of these names is well established in the Smalltalk community and has not been changed in CLDT. The messages at:ifAbsentPut:, at:ifPresent:, removeAllKeys:, and removeAllKeys:ifAbsent: are not in the Blue Book, but have been included in CLDT because their use results in more compact and readable code. |
Porting tip: | The messages at:ifAbsentPut:, at:ifPresent:, removeAllKeys:, and removeAllKeys:ifAbsent: are not supported in Smalltalk/V or Objectworks\Smalltalk. |
associationsDo:, keysAndValuesDo:, keysDo:
collect:, conform:, detect:, detect:ifNone:, do:, inject:into:, reject:, select:
Note: | The message conform: checks if each element of a collection satisfies a condition, expressed as a one-argument block. Even though conform: is not defined in the Blue Book, it has been included because it seems to be a natural complement to the other Blue Book enumeration methods. |
Porting tip: | The conform: message is not supported in Smalltalk/V or Objectworks\Smalltalk. |
doWithIndex:, from:to:do:, from:to:doWithIndex:, reverseDo:, with:do:
Note: | The semantics of both of these operations require that the receiver collection be ordered. |
Porting tip: | The doWithIndex:, from:to:do", and from:to:doWithIndex:, messages are not supported in Smalltalk/V or ObjectWorks\Smalltalk. |
removeAtIndex:, removeFirst, removeLast
rehash
Note: | It is customary for collections such as Set, Dictionary, IdentityDictionary, and LookupTableto use the hash of elements to implement efficient access and store operations. The use of element hash values to locate elements creates a problem if the hash values of the elements change for some reason. For example, if a copy of the collection is passed to another platform in a distributed system that uses different hash functions for objects in the collection, the collection will not function correctly. The rehash message enables implementers to guarantee that hash-based accessing is safe. |
remove:, remove:ifAbsent:, removeAll:
<, <=, >, >=, asLowercase, asNumber, asString, asSymbol, asUppercase, indexOf:matchCase:startingAt:, match:, nullTerminated, sameAs:, subStrings, subStrings:
Note: | Implementations of the messages <, <=, >, and >= use the U.S. English collation sequence and do not necessarily reflect the collation sequence used by the underlying platform. The message is needed for practical string searching. |
Porting tip: | Smalltalk/V does not support match: and sameAs:. It also uses asLowerCase and asUpperCase rather than the Blue Book (and IBM Smalltalk) spelling asLowercase and asUppercase. Neither Smalltalk/V nor Objectworks\Smalltalk support indexOf:matchCase:startingAt:. Collating sequences vary from platform to platform (for example, case sensitivity) and from language to language (for example, some languages treat certain combinations of letters as a single character). String comparison results can therefore differ between platforms. The messages <, <=, >, and >= perform case insensitive comparison, while the = message is case sensitive. This means, for example, that <= is not the "logical or" of < and =. Use sameAs: instead of = for case insensitive equality comparison. |
at:put:, atAll:put:, atAllPut:, basicAt:put:, replaceFrom:to:with:, replaceFrom:to:with:startingAt:, replaceFrom:to:withObject:
Note: | The message replaceFrom:to:withObject: is not in the Blue Book but has been included in CLDT for symmetry and completeness. |
Porting tip: | The method replaceFrom:to:withObject: is supported in Smalltalk/V but not in Objectworks\Smalltalk. |
includes:, isEmpty, notEmpty, occurrencesOf:, size