HashSet<T>

Overview

Hashset implementation for Island; A hashset is a set of (unique) items that has methods to enumerate and check if the set contains a value.

Location

 

constructor

Creates a hashset

 

constructor

 

HashSet<T>()

 

init()

 

HashSet<T>()

constructor (IEqualityComparer<T>)

Creates a hashset

 

constructor(aComparer: IEqualityComparer<T>)

 

HashSet<T>(IEqualityComparer<T> aComparer)

 

init(_ aComparer: IEqualityComparer<T>)

 

HashSet<T>(IEqualityComparer<T> aComparer)

Parameters:

  • aComparer: The comparison implementation used to check if values are equal

constructor (Int32)

Creates a hashset

 

constructor(aCapacity: Int32)

 

HashSet<T>(Int32 aCapacity)

 

init(_ aCapacity: Int32)

 

HashSet<T>(Int32 aCapacity)

Parameters:

  • aCapacity: The initial number of items supported by this hashset. While the set will grow if needed, this is the nr of items initially allocated.

constructor (Int32, IEqualityComparer<T>)

Creates a hashset

 

constructor(aCapacity: Int32; aComparer: IEqualityComparer<T>)

 

HashSet<T>(Int32 aCapacity, IEqualityComparer<T> aComparer)

 

init(_ aCapacity: Int32, _ aComparer: IEqualityComparer<T>)

 

HashSet<T>(Int32 aCapacity, IEqualityComparer<T> aComparer)

Parameters:

  • aCapacity: The initial number of items supported by this hashset. While the set will grow if needed, this is the nr of items initially allocated.
  • aComparer: The comparison implementation used to check if values are equal

Add

Add a new item to the hashset. Returns true if succesful, false if it already exists.

 

method Add(Item: T): Boolean

 

Boolean Add(T Item)

 

func Add(_ Item: T) -> Boolean

 

Boolean Add(T Item)

Parameters:

  • Item: The item to add

Clear

Clear this hashset.

 

method Clear

 

void Clear()

 

func Clear()

 

void Clear()

Comparer

Returns the comparer used to create this hashset.

 

property Comparer: IEqualityComparer<T> read;

 

IEqualityComparer<T> Comparer { get; }

 

var Comparer: IEqualityComparer<T> { get{} }

 

IEqualityComparer<T> Comparer { __get; }

Contains

Check if the hashset contains this item

 

method Contains(Item: T): Boolean

 

Boolean Contains(T Item)

 

func Contains(_ Item: T) -> Boolean

 

Boolean Contains(T Item)

Parameters:

  • Item: the item to check

Count

Returns the nr of items in this hashset

 

property Count: Int32 read;

 

Int32 Count { get; }

 

var Count: Int32 { get{} }

 

Int32 Count { __get; }

Equals  virtual    (declared in Object)

Returns true if the target object matches this one, by default compares the reference.

 

method Equals(obj: Object): Boolean

 

Boolean Equals(Object obj)

 

func Equals(_ obj: Object) -> Boolean

 

Boolean Equals(Object obj)

Parameters:

  • obj: the reference to compare this with.

Finalize  protected virtual    (declared in Object)

Finalizer implementation. If not overriden it's not called at all, the runtime checks if there is an override before calling a finalizer.

 

method Finalize

 

void Finalize()

 

func Finalize()

 

void Finalize()

ForEach

Iterates this hashset, triggering a delegate for every item

 

method ForEach(Action: Action<T>)

 

void ForEach(Action<T> Action)

 

func ForEach(_ Action: Action<T>)

 

void ForEach(Action1<T> Action)

Parameters:

  • Action: The delegate to trigger

GetHashCode  virtual    (declared in Object)

Returns a hashcode for this object. Overriden implementations should make sure that the number returned here is constant given the same object.

 

method GetHashCode: Int32

 

Int32 GetHashCode()

 

func GetHashCode() -> Int32

 

Int32 GetHashCode()

GetSequence

Returns a sequence with all items in this hashset

 

method GetSequence: IEnumerable<T>

 

IEnumerable<T> GetSequence()

 

func GetSequence() -> IEnumerable<T>

 

IEnumerable<T> GetSequence()

GetType    (declared in Object)

Returns the actual type of this class

 

method GetType: Type

 

Type GetType()

 

func GetType() -> Type

 

Type GetType()

Items

Returns a sequence with all items in this hashset

 

property Items: IEnumerable<T> read;

 

IEnumerable<T> Items { get; }

 

var Items: IEnumerable<T> { get{} }

 

IEnumerable<T> Items { __get; }

ReferenceEquals    (declared in Object)

Compares two references for equivalence (even if they have an equals operator)

 

class method ReferenceEquals(a: Object; b: Object): Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

 

static func ReferenceEquals(_ a: Object, _ b: Object) -> Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

Parameters:

  • a: left value
  • b: right value

Remove

Removes an item from this hashset, returns true if succesful or false if it wasn't there

 

method Remove(Item: T): Boolean

 

Boolean Remove(T Item)

 

func Remove(_ Item: T) -> Boolean

 

Boolean Remove(T Item)

Parameters:

  • Item: The item to remove

ToString  virtual    (declared in Object)

Gets the string representation of this method.

 

method ToString: String

 

String ToString()

 

func ToString() -> String

 

String ToString()

 

Comparer

Returns the comparer used to create this hashset.

 

property Comparer: IEqualityComparer<T> read;

 

IEqualityComparer<T> Comparer { get; }

 

var Comparer: IEqualityComparer<T> { get{} }

 

IEqualityComparer<T> Comparer { __get; }

Count

Returns the nr of items in this hashset

 

property Count: Int32 read;

 

Int32 Count { get; }

 

var Count: Int32 { get{} }

 

Int32 Count { __get; }

Items

Returns a sequence with all items in this hashset

 

property Items: IEnumerable<T> read;

 

IEnumerable<T> Items { get; }

 

var Items: IEnumerable<T> { get{} }

 

IEnumerable<T> Items { __get; }

 

ReferenceEquals    (declared in Object)

Compares two references for equivalence (even if they have an equals operator)

 

class method ReferenceEquals(a: Object; b: Object): Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

 

static func ReferenceEquals(_ a: Object, _ b: Object) -> Boolean

 

static Boolean ReferenceEquals(Object a, Object b)

Parameters:

  • a: left value
  • b: right value

 

constructor

Creates a hashset

 

constructor

 

HashSet<T>()

 

init()

 

HashSet<T>()

constructor (IEqualityComparer<T>)

Creates a hashset

 

constructor(aComparer: IEqualityComparer<T>)

 

HashSet<T>(IEqualityComparer<T> aComparer)

 

init(_ aComparer: IEqualityComparer<T>)

 

HashSet<T>(IEqualityComparer<T> aComparer)

Parameters:

  • aComparer: The comparison implementation used to check if values are equal

constructor (Int32)

Creates a hashset

 

constructor(aCapacity: Int32)

 

HashSet<T>(Int32 aCapacity)

 

init(_ aCapacity: Int32)

 

HashSet<T>(Int32 aCapacity)

Parameters:

  • aCapacity: The initial number of items supported by this hashset. While the set will grow if needed, this is the nr of items initially allocated.

constructor (Int32, IEqualityComparer<T>)

Creates a hashset

 

constructor(aCapacity: Int32; aComparer: IEqualityComparer<T>)

 

HashSet<T>(Int32 aCapacity, IEqualityComparer<T> aComparer)

 

init(_ aCapacity: Int32, _ aComparer: IEqualityComparer<T>)

 

HashSet<T>(Int32 aCapacity, IEqualityComparer<T> aComparer)

Parameters:

  • aCapacity: The initial number of items supported by this hashset. While the set will grow if needed, this is the nr of items initially allocated.
  • aComparer: The comparison implementation used to check if values are equal

Add

Add a new item to the hashset. Returns true if succesful, false if it already exists.

 

method Add(Item: T): Boolean

 

Boolean Add(T Item)

 

func Add(_ Item: T) -> Boolean

 

Boolean Add(T Item)

Parameters:

  • Item: The item to add

Clear

Clear this hashset.

 

method Clear

 

void Clear()

 

func Clear()

 

void Clear()

Contains

Check if the hashset contains this item

 

method Contains(Item: T): Boolean

 

Boolean Contains(T Item)

 

func Contains(_ Item: T) -> Boolean

 

Boolean Contains(T Item)

Parameters:

  • Item: the item to check

Equals  virtual    (declared in Object)

Returns true if the target object matches this one, by default compares the reference.

 

method Equals(obj: Object): Boolean

 

Boolean Equals(Object obj)

 

func Equals(_ obj: Object) -> Boolean

 

Boolean Equals(Object obj)

Parameters:

  • obj: the reference to compare this with.

Finalize  protected virtual    (declared in Object)

Finalizer implementation. If not overriden it's not called at all, the runtime checks if there is an override before calling a finalizer.

 

method Finalize

 

void Finalize()

 

func Finalize()

 

void Finalize()

ForEach

Iterates this hashset, triggering a delegate for every item

 

method ForEach(Action: Action<T>)

 

void ForEach(Action<T> Action)

 

func ForEach(_ Action: Action<T>)

 

void ForEach(Action1<T> Action)

Parameters:

  • Action: The delegate to trigger

GetHashCode  virtual    (declared in Object)

Returns a hashcode for this object. Overriden implementations should make sure that the number returned here is constant given the same object.

 

method GetHashCode: Int32

 

Int32 GetHashCode()

 

func GetHashCode() -> Int32

 

Int32 GetHashCode()

GetSequence

Returns a sequence with all items in this hashset

 

method GetSequence: IEnumerable<T>

 

IEnumerable<T> GetSequence()

 

func GetSequence() -> IEnumerable<T>

 

IEnumerable<T> GetSequence()

GetType    (declared in Object)

Returns the actual type of this class

 

method GetType: Type

 

Type GetType()

 

func GetType() -> Type

 

Type GetType()

Remove

Removes an item from this hashset, returns true if succesful or false if it wasn't there

 

method Remove(Item: T): Boolean

 

Boolean Remove(T Item)

 

func Remove(_ Item: T) -> Boolean

 

Boolean Remove(T Item)

Parameters:

  • Item: The item to remove

ToString  virtual    (declared in Object)

Gets the string representation of this method.

 

method ToString: String

 

String ToString()

 

func ToString() -> String

 

String ToString()