# ConcatAdapter.Config.StableIdMode

# ConcatAdapter.Config.StableIdMode

Artifact:[androidx.recyclerview:recyclerview](https://developer.android.com/jetpack/androidx/releases/recyclerview)  
[View Source](https://cs.android.com/search?q=file:androidx/recyclerview/widget/ConcatAdapter.java+class:androidx.recyclerview.widget.ConcatAdapter.Config.StableIdMode)  
Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.2.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode "View this page in Java")

<br />

```
enum ConcatAdapter.Config.StableIdMode
```

<br />

*** ** * ** ***

Defines how[ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter)handle stable ids ([hasStableIds](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasStableIds())).

## Summary

|                                                                     ### Enum Values                                                                      |
|----------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ISOLATED_STABLE_IDS](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode#ISOLATED_STABLE_IDS) | In this mode,[ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter)will return`true`from[hasStableIds](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasStableIds())and will**require** all added[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)s to have stable ids. |
| [NO_STABLE_IDS](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode#NO_STABLE_IDS)             | In this mode,[ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter)ignores the stable ids reported by sub adapters.                                                                                                                                                                                                                                                                  |
| [SHARED_STABLE_IDS](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode#SHARED_STABLE_IDS)     | In this mode,[ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter)will return`true`from[hasStableIds](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasStableIds())and will**require** all added[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)s to have stable ids. |

|                                                                                                                  ### Public functions                                                                                                                   |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[ConcatAdapter.Config.StableIdMode](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode)`!`                                                                                     | [valueOf](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode#valueOf(java.lang.String))`(name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Returns the enum constant of this type with the specified name. |
| `java-static `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[ConcatAdapter.Config.StableIdMode](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode)`!>!` | [values](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode#values())`()` Returns an array containing the constants of this enum type, in the order they're declared.                                                                                 |

## Enum Values

### ISOLATED_STABLE_IDS

```
val ConcatAdapter.Config.StableIdMode.ISOLATED_STABLE_IDS: ConcatAdapter.Config.StableIdMode
```

In this mode,[ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter)will return`true`from[hasStableIds](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasStableIds())and will**require** all added[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)s to have stable ids. As two different adapters may return same stable ids because they are unaware of each-other,[ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter)will isolate each[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)'s id pool from each other such that it will overwrite the reported stable id before reporting back to the[RecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView). In this mode, the value returned from[getItemId](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder#getItemId())might differ from the value returned from[getItemId](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#getItemId(int)). Adding an adapter without stable ids will result in an[IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html).  

### NO_STABLE_IDS

```
val ConcatAdapter.Config.StableIdMode.NO_STABLE_IDS: ConcatAdapter.Config.StableIdMode
```

In this mode,[ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter)ignores the stable ids reported by sub adapters. This is the default mode. Adding an[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)with stable ids will result in a warning as it will be ignored.  

### SHARED_STABLE_IDS

```
val ConcatAdapter.Config.StableIdMode.SHARED_STABLE_IDS: ConcatAdapter.Config.StableIdMode
```

In this mode,[ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter)will return`true`from[hasStableIds](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasStableIds())and will**require** all added[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)s to have stable ids. Unlike[ISOLATED_STABLE_IDS](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode#ISOLATED_STABLE_IDS),[ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter)will not override the returned item ids. In this mode, child[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)s must be aware of each-other and never return the same id unless and item is moved between[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)s. Adding an adapter without stable ids will result in an[IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html).  

## Public functions

### valueOf

Added in 1.2.0  

```
java-static fun valueOf(name: String!): ConcatAdapter.Config.StableIdMode!
```

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)  

|                                                                        Returns                                                                        |
|-------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [ConcatAdapter.Config.StableIdMode](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode)`!` | the enum constant with the specified name |

|                                                        Throws                                                         |
|-----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| [java.lang.IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if this enum type has no constant with the specified name |

### values

Added in 1.2.0  

```
java-static fun values(): Array<ConcatAdapter.Config.StableIdMode!>!
```

Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.  

|                                                                                                                  Returns                                                                                                                  |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| [Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[ConcatAdapter.Config.StableIdMode](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode)`!>!` | an array containing the constants of this enum type, in the order they're declared |