# PreferenceGroupKt

Added in 1.0.0

*** ** * ** ***


```
public final class PreferenceGroupKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final boolean` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).contains(androidx.preference.Preference)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference preference)` Returns `true` if `preference` is found in this preference group. |
| `static final void` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).forEach(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> action )` Performs the given action on each preference in this preference group. |
| `static final void` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).forEachIndexed(kotlin.Function2)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> action )` Performs the given action on each preference in this preference group, providing its sequential index. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).get(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver, int index)` Returns the preference at `index`. |
| `static final T` | `<T extends https://developer.android.com/reference/androidx/preference/Preference> https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).get(kotlin.CharSequence)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html key )` Returns the preference with `key`, or `null` if no preference with `key` is found. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference>` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).getChildren()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver)` Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html` over the preferences in this preference group. |
| `static final int` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).getSize()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver)` Returns the number of preferences in this preference group. |
| `static final boolean` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).isEmpty()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver)` Returns true if this preference group contains no preferences. |
| `static final boolean` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).isNotEmpty()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver)` Returns true if this preference group contains one or more preferences. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Iterator.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference>` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).iterator()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver)` Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-iterator/index.html` over the preferences in this preference group. |
| `static final void` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).minusAssign(androidx.preference.Preference)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference preference )` Removes `preference` from this preference group. |
| `static final void` | `https://developer.android.com/reference/androidx/preference/PreferenceGroupKt#(androidx.preference.PreferenceGroup).plusAssign(androidx.preference.Preference)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceGroup receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference preference )` Adds `preference` to this preference group. |

## Public methods

### contains

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:contains) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final boolean contains(@NonNull PreferenceGroup receiver, @NonNull Preference preference)
```

Returns `true` if `preference` is found in this preference group.

### forEach

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:forEach) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final void forEach(
    @NonNull PreferenceGroup receiver,
    @NonNull Function1<@NonNull Preference, Unit> action
)
```

Performs the given action on each preference in this preference group.

### forEachIndexed

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:forEachIndexed) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final void forEachIndexed(
    @NonNull PreferenceGroup receiver,
    @NonNull Function2<@NonNull Integer, @NonNull Preference, Unit> action
)
```

Performs the given action on each preference in this preference group, providing its sequential index.

### get

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:get) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final @NonNull Preference get(@NonNull PreferenceGroup receiver, int index)
```

Returns the preference at `index`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if index is less than 0 or greater than or equal to the count. |

### get

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:get) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/preference#1.1.0)

```
public static final T <T extends Preference> get(
    @NonNull PreferenceGroup receiver,
    @NonNull CharSequence key
)
```

Returns the preference with `key`, or `null` if no preference with `key` is found.

### getChildren

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+symbol:children) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final @NonNull Sequence<@NonNull Preference> getChildren(@NonNull PreferenceGroup receiver)
```

Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html` over the preferences in this preference group.

### getSize

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+symbol:size) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final int getSize(@NonNull PreferenceGroup receiver)
```

Returns the number of preferences in this preference group.

### isEmpty

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:isEmpty) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final boolean isEmpty(@NonNull PreferenceGroup receiver)
```

Returns true if this preference group contains no preferences.

### isNotEmpty

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:isNotEmpty) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final boolean isNotEmpty(@NonNull PreferenceGroup receiver)
```

Returns true if this preference group contains one or more preferences.

### iterator

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:iterator) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final @NonNull Iterator<@NonNull Preference> iterator(@NonNull PreferenceGroup receiver)
```

Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-iterator/index.html` over the preferences in this preference group.

### minusAssign

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:minusAssign) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final void minusAssign(
    @NonNull PreferenceGroup receiver,
    @NonNull Preference preference
)
```

Removes `preference` from this preference group.

### plusAssign

Artifact: [androidx.preference:preference-ktx](https://developer.android.com/jetpack/androidx/releases/preference) [View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceGroup.kt+function:plusAssign) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

```
public static final void plusAssign(
    @NonNull PreferenceGroup receiver,
    @NonNull Preference preference
)
```

Adds `preference` to this preference group.