TreeSet.st
changeset 4269 c5eb06e78a7d
parent 4211 4881ec8d1572
equal deleted inserted replaced
4268:fff51d808999 4269:c5eb06e78a7d
    93 	| bucket |
    93 	| bucket |
    94 	bucket _  tree at: (self keyForValue: anObject) ifAbsent: [^ false].
    94 	bucket _  tree at: (self keyForValue: anObject) ifAbsent: [^ false].
    95 	^ self bucket: bucket includes: anObject
    95 	^ self bucket: bucket includes: anObject
    96 !
    96 !
    97 
    97 
    98 intersection: aCollection
    98 intersect:aCollection 
    99 	aCollection species = self species ifFalse: [^ super intersection: aCollection].
    99     aCollection species ~~ self species ifTrue:[
   100 	aCollection sortSelector = self sortSelector ifFalse: [^ super intersection: aCollection].
   100         ^ super intersect:aCollection
   101 	
   101     ].
   102 	^ Array streamContents:
   102     aCollection sortSelector ~= self sortSelector ifTrue:[
   103 		[:s |
   103         ^ super intersect:aCollection
   104 		tree commonKeysWith: aCollection tree keysAndValuesDo:
   104     ].
   105 			[:key :left :right |
   105     ^ Array 
   106 			s nextPutAll: (left intersection: right)]]
   106         streamContents:[:s | 
       
   107             tree commonKeysWith:aCollection tree
       
   108                 keysAndValuesDo:[:key :left :right | s nextPutAll:(left intersect:right)]
       
   109         ]
       
   110 
       
   111     "Created: / 20-01-2017 / 19:23:01 / stefan"
   107 !
   112 !
   108 
   113 
   109 remove: anObject
   114 remove: anObject
   110     "remove all occurrences of anObject
   115     "remove all occurrences of anObject
   111      Warning:
   116      Warning: