Set


Collections-Unordered

Comment:



Hierarchy:

ProtoObject
Object
Collection
Set

Summary:

instance variables:

array tally

methods:

instance class
accessing
  • asArray
  • capacity
  • someElement
adding
  • ,
  • add:
converting
  • asSet
enumerating
  • collect:
  • do:
  • doWithIndex:
objects from disk
  • comeFullyUpOnReload:
private
  • array
  • atNewIndex:put:
  • copy
  • findElementOrNil:
  • fixCollisionsFrom:
  • fullCheck
  • grow
  • growSize
  • init:
  • keyAt:
  • noCheckAdd:
  • rehash
  • scanFor:
  • size
  • swap:with:
  • withArray:
removing
  • -
  • copyWithout:
  • remove:ifAbsent:
set operations testing
  • =
  • includes:
  • occurrencesOf:
initialization
  • rehashAllSets
instance creation
  • new
  • new:
  • newFrom:
  • sizeFor:

Detail:

instance variables:

array
InitialValue:
(nil nil nil nil nil nil )
inferredType:
Array
tally
InitialValue:
0
inferredType:
SmallInteger

instance methods:

adding
, aCollection
 
	"Answer a copy of the receiver concatenated with the argument, aCollection."
	
	^self copy
		addAll: aCollection asSet;
		yourself

removing
- aSet

	"Answer those elements present in the receiver and absent from aSet."
	"SmallInterfaces: ##added for Squeak -M.U. 6/23/1999 23:35"
	^self reject: [ :i | aSet includes: i ]

set operations
& aSet
 
	"Set intersection"

	^self intersectionWith: aSet
+ aCollection
 
	"Set union"

	^self , aCollection
intersectionWith: aSet

	"Intersection of two sets."

	^self select: [:each | aSet includes: each]
intersectionWithSet: aSet

	"Return the elements in common with receiver and aSet as a set with one instance of each element.
	<#(1 2 3) asSet intersectionWithSet: #(2 3 4) asSet>"

	^(self size <= aSet size)
		ifTrue: [self select: [:each | aSet includes: each]]
		ifFalse: [aSet intersectionWithSet: self]

class methods:

^top


- made by Dandelion -