changed: #first
authorStefan Vogel <sv@exept.de>
Mon, 13 Aug 2012 13:15:33 +0200
changeset 2806 589bf1d35322
parent 2805 fe663de687c1
child 2807 43cfa45ff6fc
changed: #first remove send of #emptyCheck
Heap.st
--- a/Heap.st	Mon Aug 13 13:15:08 2012 +0200
+++ b/Heap.st	Mon Aug 13 13:15:33 2012 +0200
@@ -141,9 +141,16 @@
 !
 
 first
-	"Return the first element in the receiver"
-	self emptyCheck.
-	^array at: 1
+    "Return the first element in the receiver"
+
+    self isEmpty ifTrue:[
+       ^ self emptyCollectionError.
+    ].
+    ^ array at: 1
+
+    "
+      Heap new first
+    "
 !
 
 firstOrNil
@@ -365,9 +372,9 @@
 !Heap class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Heap.st,v 1.2 2009-11-27 21:18:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Heap.st,v 1.3 2012-08-13 11:15:33 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/Heap.st,v 1.2 2009-11-27 21:18:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Heap.st,v 1.3 2012-08-13 11:15:33 stefan Exp $'
 ! !