# ComparablePrincipal

Class · Stable

Helper class for working with `IComparablePrincipal`s.

- Source: [`aws-iam/lib/principals.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-iam/lib/principals.ts#L94)
- Type last changed: v2.26.0 · 30 May 2022

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iam as iam } from 'aws-cdk-lib';
const comparablePrincipal = new iam.ComparablePrincipal();
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_iam as iam

comparable_principal = iam.ComparablePrincipal()
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.iam.*;

ComparablePrincipal comparablePrincipal = new ComparablePrincipal();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.IAM;

var comparablePrincipal = new ComparablePrincipal();
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

comparablePrincipal := awscdk.Aws_iam.NewComparablePrincipal()
```

## Initializer

TypeScript:

```ts
new ComparablePrincipal()
```

Python:

```python
ComparablePrincipal()
```

Java:

```java
new ComparablePrincipal()
```

C#:

```csharp
new ComparablePrincipal()
```

Go:

```go
NewComparablePrincipal()
```

## Methods

- `dedupeStringFor(x: IPrincipal): string` (static) — Return the dedupeString of the given principal, if available.

- `isComparablePrincipal(x: IPrincipal): boolean` (static) — Whether or not the given principal is a comparable principal.
