Class TgoReadOnlySet

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TgoReadOnlySet<T> = class(TEnumerable<T>)

Description

Generic read-only set. Provides a read-only view of a TgoSet<T>

Hierarchy

  • TEnumerable
  • TgoReadOnlySet

Overview

Methods

Public function ToArray: TArray<T>; override; final;
Public function DoGetEnumerator: TEnumerator<T>; override;
Public constructor Create; overload;
Public constructor Create(const AComparer: IEqualityComparer<T>); overload;
Public function Contains(const AItem: T): Boolean;

Properties

Public property Count: Integer read FCount;

Description

Methods

Public function ToArray: TArray<T>; override; final;

Copies the items in the set to a dynamic array

Public function DoGetEnumerator: TEnumerator<T>; override;

Allow for..in enumeration of the items in the set.

Public constructor Create; overload;

Creates a read-only set using a default comparer.

Public constructor Create(const AComparer: IEqualityComparer<T>); overload;

Creates a read-only set using a custom comparer.

Parameters
AComparer
the comparer to use to check for item equality. Pass nil to use the default comparer.
Public function Contains(const AItem: T): Boolean;

Checks if the set contains a given item. This is an O(1) operation that uses the set's comparer to check for equality.

Parameters
AItem
the item to check.
Returns

True if the set contains AItem, False if not.

Properties

Public property Count: Integer read FCount;

The number of items in the set


Generated by P2PasDoc 0.13.0 on 2017-04-25 12:54:26