#FEATURE by stefan
authorStefan Vogel <sv@exept.de>
Tue, 20 Mar 2018 15:52:54 +0100
changeset 22640 a09d68b5a519
parent 22639 468e2dcbd196
child 22641 b7e8988896dd
#FEATURE by stefan class: UndefinedObject added: #asCollectionOrEmptyIfNil #doIfNotNil: removed: #isNilOrEmptyCollection #isNotNil
UndefinedObject.st
--- a/UndefinedObject.st	Tue Mar 20 15:52:18 2018 +0100
+++ b/UndefinedObject.st	Tue Mar 20 15:52:54 2018 +0100
@@ -110,6 +110,7 @@
     "Modified: 3.1.1997 / 15:06:15 / cg"
 ! !
 
+
 !UndefinedObject class methodsFor:'queries'!
 
 canBeSubclassed
@@ -153,18 +154,36 @@
 ! !
 
 
+
+
 !UndefinedObject methodsFor:'converting'!
 
 asBoolean
     ^ false
 !
 
+asCollectionOrEmptyIfNil
+    "answer an empty collection"
+
+    ^ #()
+
+    "Created: / 20-03-2018 / 15:23:56 / stefan"
+!
+
 asNilIfEmpty
     "I am nil, so answer nil"
 
     ^ self
 !
 
+doIfNotNil:aBlock
+    "answer an empty collection"
+
+    ^ nil
+
+    "Created: / 20-03-2018 / 15:37:11 / stefan"
+!
+
 literalArrayEncoding
     "encode myself as an array literal, from which a copy of the receiver
      can be reconstructed with #decodeAsLiteralArray."
@@ -321,6 +340,7 @@
     "Modified (comment): / 17-05-2017 / 16:37:19 / mawalch"
 ! !
 
+
 !UndefinedObject methodsFor:'subclass creation'!
 
 nilSubclass:action
@@ -695,30 +715,6 @@
     ^ true
 !
 
-isNilOrEmptyCollection
-    "return true if I am nil or an empty collection - false here.
-     Obsolete, use isEmptyOrNil."
-
-    <resource:#obsolete>
-
-    ^ true
-
-    "Modified: / 13.11.2001 / 13:28:15 / cg"
-!
-
-isNotNil
-    <resource: #obsolete>
-
-    "Return true if the receiver is not nil.
-     Since I am definitely nil, unconditionally return false here.
-     the receiver is definitely not nil here, so unconditionally return false."
-
-    self obsoleteMethodWarning:'use #notNil'.
-    ^ false
-
-    "Created: / 26-10-2014 / 01:30:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 notEmptyOrNil
     "Squeak compatibility:
      return true if I am neither nil nor an empty collection."
@@ -754,6 +750,8 @@
     ^ aVisitor visitNilWith:aParameter
 ! !
 
+
+
 !UndefinedObject class methodsFor:'documentation'!
 
 version