--- a/Collection.st Mon Jan 23 12:38:52 2006 +0100
+++ b/Collection.st Mon Jan 23 22:21:47 2006 +0100
@@ -295,6 +295,39 @@
^ self anElement
!
+ifEmpty:ifEmptyValue ifNotEmpty:ifNotEmptyValue
+ |action|
+
+ action := self isEmpty ifTrue:[ ifEmptyValue ] ifFalse:[ ifNotEmptyValue ].
+
+ action isBlock ifTrue:[
+ action numArgs == 1 ifTrue:[
+ ^ action value:self
+ ]
+ ].
+ ^ action value
+!
+
+ifEmpty:ifEmptyValue ifNotEmptyDo:ifNotEmptyValue
+ ^ self ifEmpty:ifEmptyValue ifNotEmpty:ifNotEmptyValue
+!
+
+ifEmptyDo:ifEmptyValue ifNotEmpty:ifNotEmptyValue
+ ^ self ifEmpty:ifEmptyValue ifNotEmpty:ifNotEmptyValue
+!
+
+ifNotEmpty:ifNotEmptyValue
+ ^ self ifEmpty:nil ifNotEmpty:ifNotEmptyValue
+!
+
+ifNotEmptyDo:ifNotEmptyValue
+ ^ self ifEmpty:nil ifNotEmpty:ifNotEmptyValue
+!
+
+ifNotEmptyDo:ifNotEmptyValue ifEmpty:ifEmptyValue
+ ^ self ifEmpty:ifEmptyValue ifNotEmpty:ifNotEmptyValue
+!
+
withIndexDo:aTwoArgBlock
"evaluate the argument, aBlock for every element in the collection,
passing both element and index as arguments."
@@ -2833,7 +2866,7 @@
!Collection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.178 2005-11-30 22:06:37 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.179 2006-01-23 21:21:47 cg Exp $'
! !
Collection initialize!