#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Wed, 24 Aug 2016 17:06:42 +0200
changeset 20302 a17559e67c68
parent 20301 af76baeacf78
child 20303 060fea1cfebe
child 20343 0719a15ae26d
#FEATURE by cg class: Collection added: #isValidElement:
Collection.st
--- a/Collection.st	Wed Aug 24 17:06:18 2016 +0200
+++ b/Collection.st	Wed Aug 24 17:06:42 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -15,8 +17,8 @@
 
 Object subclass:#Collection
 	instanceVariableNames:''
-	classVariableNames:'InvalidKeySignal EmptyCollectionSignal ValueNotFoundSignal
-		NotEnoughElementsSignal'
+	classVariableNames:'EmptyCollectionSignal InvalidKeySignal NotEnoughElementsSignal
+		ValueNotFoundSignal'
 	poolDictionaries:''
 	category:'Collections-Abstract'
 !
@@ -4333,7 +4335,7 @@
     aStream nextPut:$)
 
     "
-     #(1 2 3 'hello' $a $ü) printOn:Transcript
+     #(1 2 3 'hello' $a $ü) printOn:Transcript
      (Array new:100000) printOn:Transcript
      (Array new:100000) printOn:Stdout
      (Array new:100000) printString size
@@ -4443,6 +4445,14 @@
     ^ false
 !
 
+isValidElement:anObject
+    "return true, if I can hold this kind of object"
+
+    "/ here, true is returned for any.
+    "/ nust be redefined in subclasses which do nt allow some (i.e. ByteArray)
+    ^ true
+!
+
 isWritable
     "true if this is not a readOnly (immutable) collection.
      Q1: should this be called isMutable?
@@ -5679,7 +5689,7 @@
 includesAll:aCollection
     "return true if the receiver includes all elements of
      the argument, aCollection; false if any is missing.
-     Notice: this method has O² runtime behavior and may be
+     Notice: this method has O² runtime behavior and may be
              slow for big receivers/args.
              Think about using a Set, or Dictionary."
 
@@ -5699,7 +5709,7 @@
      Return false if it includes none.
      Uses #= (value compare)
      Notice:
-        this method has O² runtime behavior for some subclasses and may be slow for big receivers/args.
+        this method has O² runtime behavior for some subclasses and may be slow for big receivers/args.
         Think about using a Set or Dictionary.
         Some speedup is also possible, by arranging highly
         probable elements towards the beginning of aCollection, to avoid useless searches.
@@ -5769,7 +5779,7 @@
      Return false if it includes none.
      Use identity compare for comparing.
      Notice:
-        this method has O² runtime behavior for some subclasses and may be slow for big receivers/args.
+        this method has O² runtime behavior for some subclasses and may be slow for big receivers/args.
         Think about using a Set or Dictionary.
         Some speedup is also possible, by arranging highly
         probable elements towards the beginning of aCollection, to avoid useless searches."