Show: Delphi C++
Display Preferences

System.Generics.Defaults.IEqualityComparer

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

IEqualityComparer<T> = interface

C++

template<typename T> __interface IEqualityComparer__1  : public System::IInterface

Properties

Type Visibility Source Unit Parent
interface
class
public
System.Generics.Defaults.pas
System.Generics.Defaults.hpp
System.Generics.Defaults System.Generics.Defaults

Description

IEqualityComparer is the generic interface used to check the equality of two values.

IEqualityComparer is implemented by classes that need to support an equality comparison for two values of the same type. Generic collections require instances of classes that implement the IEqualityComparer interface in order to provide support for custom data types. For example, the Equals method is used by TList to compare whether a given value is present in the list. Aside from checking the equality of two values, IEqualityComparer also provides a GetHashCode method that is used to generate a hash code for any value. GetHashCode is extensively used in hash based map classes like TDictionary.

Note: We recommend that the TEqualityComparer class is used as base for custom equality comparers instead of directly implementing the IEqualityComparer interface.

See Also

Code Examples


Personal tools
In Other Languages
Previous Versions
Assistance