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

 

constructor

 

HashSet<T>()

 

init()

 

HashSet<T>()

 

Sub New()

constructor (Int32)

 

constructor(aCapacity: Int32)

 

HashSet<T>(Int32 aCapacity)

 

init(_ aCapacity: Int32)

 

HashSet<T>(Int32 aCapacity)

 

Sub New(aCapacity As Int32)

Parameters:

  • aCapacity:

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)

 

Sub New(aCapacity As Int32, aComparer As IEqualityComparer<T>)

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

constructor (IEqualityComparer<T>)

 

constructor(aComparer: IEqualityComparer<T>)

 

HashSet<T>(IEqualityComparer<T> aComparer)

 

init(_ aComparer: IEqualityComparer<T>)

 

HashSet<T>(IEqualityComparer<T> aComparer)

 

Sub New(aComparer As IEqualityComparer<T>)

Parameters:

  • aComparer:

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)

 

Function Add(Item As T) As Boolean

Parameters:

  • Item: The item to add

Clear

 

method Clear

 

void Clear()

 

func Clear()

 

void Clear()

 

Sub 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; }

 

ReadOnly Property Comparer() As IEqualityComparer<T>

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)

 

Function Contains(Item As T) As Boolean

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; }

 

ReadOnly Property Count() As Int32

Equals  virtual    (declared in Object)

Default constructor.

 

method Equals(aOther: Object): Boolean

 

Boolean Equals(Object aOther)

 

func Equals(_ aOther: Object) -> Boolean

 

Boolean Equals(Object aOther)

 

Function Equals(aOther As Object) As Boolean

Parameters:

  • aOther: the reference to compare this with.

Finalize  protected virtual    (declared in Object)

 

method Finalize

 

void Finalize()

 

func Finalize()

 

void Finalize()

 

Sub 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(Action<T> Action)

 

Sub ForEach(Action As Action<T>)

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()

 

Function GetHashCode() As Int32

GetSequence

Returns a sequence with all items in this hashset

 

method GetSequence: IEnumerable<T>

 

IEnumerable<T> GetSequence()

 

func GetSequence() -> IEnumerable<T>

 

IEnumerable<T> GetSequence()

 

Function GetSequence() As IEnumerable<T>

GetType    (declared in Object)

Returns the actual type of this class

 

method GetType: Type

 

Type GetType()

 

func GetType() -> Type

 

Type GetType()

 

Function GetType() As Type

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; }

 

ReadOnly Property Items() As IEnumerable<T>

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)

 

Shared Function ReferenceEquals(a As Object, b As Object) As Boolean

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)

 

Function Remove(Item As T) As Boolean

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()

 

Function ToString() As String

 

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; }

 

ReadOnly Property Comparer() As IEqualityComparer<T>

Count

Returns the nr of items in this hashset

 

property Count: Int32 read;

 

Int32 Count { get; }

 

var Count: Int32 { get{} }

 

Int32 Count { __get; }

 

ReadOnly Property Count() As Int32

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; }

 

ReadOnly Property Items() As IEnumerable<T>

 

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)

 

Shared Function ReferenceEquals(a As Object, b As Object) As Boolean

Parameters:

  • a: left value
  • b: right value

 

constructor

 

constructor

 

HashSet<T>()

 

init()

 

HashSet<T>()

 

Sub New()

constructor (Int32)

 

constructor(aCapacity: Int32)

 

HashSet<T>(Int32 aCapacity)

 

init(_ aCapacity: Int32)

 

HashSet<T>(Int32 aCapacity)

 

Sub New(aCapacity As Int32)

Parameters:

  • aCapacity:

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)

 

Sub New(aCapacity As Int32, aComparer As IEqualityComparer<T>)

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

constructor (IEqualityComparer<T>)

 

constructor(aComparer: IEqualityComparer<T>)

 

HashSet<T>(IEqualityComparer<T> aComparer)

 

init(_ aComparer: IEqualityComparer<T>)

 

HashSet<T>(IEqualityComparer<T> aComparer)

 

Sub New(aComparer As IEqualityComparer<T>)

Parameters:

  • aComparer:

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)

 

Function Add(Item As T) As Boolean

Parameters:

  • Item: The item to add

Clear

 

method Clear

 

void Clear()

 

func Clear()

 

void Clear()

 

Sub 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)

 

Function Contains(Item As T) As Boolean

Parameters:

  • Item: the item to check

Equals  virtual    (declared in Object)

Default constructor.

 

method Equals(aOther: Object): Boolean

 

Boolean Equals(Object aOther)

 

func Equals(_ aOther: Object) -> Boolean

 

Boolean Equals(Object aOther)

 

Function Equals(aOther As Object) As Boolean

Parameters:

  • aOther: the reference to compare this with.

Finalize  protected virtual    (declared in Object)

 

method Finalize

 

void Finalize()

 

func Finalize()

 

void Finalize()

 

Sub 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(Action<T> Action)

 

Sub ForEach(Action As Action<T>)

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()

 

Function GetHashCode() As Int32

GetSequence

Returns a sequence with all items in this hashset

 

method GetSequence: IEnumerable<T>

 

IEnumerable<T> GetSequence()

 

func GetSequence() -> IEnumerable<T>

 

IEnumerable<T> GetSequence()

 

Function GetSequence() As IEnumerable<T>

GetType    (declared in Object)

Returns the actual type of this class

 

method GetType: Type

 

Type GetType()

 

func GetType() -> Type

 

Type GetType()

 

Function GetType() As Type

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)

 

Function Remove(Item As T) As Boolean

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()

 

Function ToString() As String