SavedStateReader


value public final class SavedStateReader


An inline class that encapsulates an opaque SavedState, and provides an API for reading the platform specific state.

See also
read

Summary

Public methods

final boolean

Checks if the SavedState contains the specified key.

final boolean

Checks if the two specified SavedState are deeply equal to one another.

final int

Returns a hash code based on the "deep contents" of specified SavedState.

final @NonNull String

Returns a string representation of the contents of this SavedState as if it is a List.

final @NonNull IBinder

Retrieves an IBinder value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final IBinder

Retrieves a IBinder value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final boolean

Retrieves a Boolean value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull boolean[]

Retrieves a BooleanArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final boolean[]

Retrieves a BooleanArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final Boolean

Retrieves a Boolean value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final char

Retrieves a Char value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull char[]

Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final char[]

Retrieves a CharArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final Character

Retrieves a Char value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull CharSequence

Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull CharSequence[]

Retrieves an Array of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final CharSequence[]

Retrieves an Array of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull List<@NonNull CharSequence>

Retrieves a List of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final List<@NonNull CharSequence>

Retrieves a List of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final CharSequence

Retrieves a CharSequence value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final double

Retrieves a Double value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull double[]

Retrieves a DoubleArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final double[]

Retrieves a DoubleArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final Double

Retrieves a Double value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final float

Retrieves a Float value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull float[]

Retrieves a FloatArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final float[]

Retrieves a FloatArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final Float

Retrieves a Float value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final int

Retrieves an Int value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull int[]

Retrieves a IntArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final int[]

Retrieves a IntArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull List<@NonNull Integer>

Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final List<@NonNull Integer>

Retrieves a List of Int values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final Integer

Retrieves an Int value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull T

Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull T
<T extends Serializable> getJavaSerializable(
    @NonNull String key,
    @NonNull KClass<@NonNull T> serializableClass
)

Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final T

Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final T
<T extends Serializable> getJavaSerializableOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> serializableClass
)

Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final long

Retrieves a Long value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull long[]

Retrieves a LongArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final long[]

Retrieves a LongArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final Long

Retrieves a Long value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull T
<T extends Parcelable> getParcelable(@NonNull String key)

Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull T
<T extends Parcelable> getParcelable(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull T[]

Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull T[]
<T extends Parcelable> getParcelableArray(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final T[]

Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final T[]
<T extends Parcelable> getParcelableArrayOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull List<@NonNull T>

Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull List<@NonNull T>
<T extends Parcelable> getParcelableList(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final List<@NonNull T>

Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final List<@NonNull T>
<T extends Parcelable> getParcelableListOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final T

Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final T
<T extends Parcelable> getParcelableOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull SavedState

Retrieves a SavedState value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull SavedState[]

Retrieves an Array of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final SavedState[]

Retrieves an Array of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull List<@NonNull SavedState>

Retrieves a List of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final List<@NonNull SavedState>

Retrieves a List of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final SavedState

Retrieves a SavedState value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull Size

Retrieves a Size value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull SizeF

Retrieves a SizeF value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final SizeF

Retrieves a SizeF value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final Size

Retrieves a Size value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull SparseArray<@NonNull T>

Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull SparseArray<@NonNull T>
<T extends Parcelable> getSparseParcelableArray(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final SparseArray<@NonNull T>

Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final SparseArray<@NonNull T>
<T extends Parcelable> getSparseParcelableArrayOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull String

Retrieves a String value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final @NonNull String[]

Retrieves an Array of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final String[]

Retrieves an Array of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final @NonNull List<@NonNull String>

Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

final List<@NonNull String>

Retrieves a List of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final String

Retrieves a String value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

final boolean

Checks if the SavedState is empty (contains no key-value pairs).

final boolean

Checks if the SavedState contains a null reference for the specified key.

final int

Returns the number of key-value pairs in the SavedState.

final @NonNull Map<@NonNull StringObject>

Returns a new Map containing all key-value pairs from the SavedState.

Public methods

contains

Added in 1.3.0-alpha11
public final boolean contains(@NonNull String key)

Checks if the SavedState contains the specified key.

Parameters
@NonNull String key

The key to check for.

Returns
boolean

true if the SavedState contains the key, false otherwise.

contentDeepEquals

public final boolean contentDeepEquals(@NonNull SavedState other)

Checks if the two specified SavedState are deeply equal to one another.

Two SavedState are considered deeply equal if they have the same size, and elements at corresponding keys are deeply equal. That is, if two corresponding elements are nested SavedState, they are also compared deeply.

If any of SavedState contains itself on any nesting level the behavior is undefined.

Parameters
@NonNull SavedState other

the object to compare deeply with this.

Returns
boolean

true if the two are deeply equal, false otherwise.

contentDeepHashCode

Added in 1.3.0-alpha11
public final int contentDeepHashCode()

Returns a hash code based on the "deep contents" of specified SavedState. If the SavedState contains other SavedState as elements, the hash code is based on their contents and so on.

The computation of the hash code returned is as if the SavedState is a List. Nested SavedState are treated as lists too.

If any of SavedState contains itself on any nesting level the behavior is undefined.

Returns
int

a deep-content-based hash code for SavedState.

contentDeepToString

Added in 1.3.0-alpha11
public final @NonNull String contentDeepToString()

Returns a string representation of the contents of this SavedState as if it is a List. Nested SavedState are treated as lists too.

If any of SavedState contains itself on any nesting level that reference is rendered as "[...]" to prevent recursion.

getBinder

Added in 1.3.0-alpha11
public final @NonNull IBinder getBinder(@NonNull String key)

Retrieves an IBinder value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull IBinder

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getBinderOrNull

Added in 1.3.0-alpha11
public final IBinder getBinderOrNull(@NonNull String key)

Retrieves a IBinder value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
IBinder

The value associated with the key, or null if no valid value is found.

getBoolean

Added in 1.3.0-alpha11
public final boolean getBoolean(@NonNull String key)

Retrieves a Boolean value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
boolean

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getBooleanArray

Added in 1.3.0-alpha11
public final @NonNull boolean[] getBooleanArray(@NonNull String key)

Retrieves a BooleanArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull boolean[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getBooleanArrayOrNull

Added in 1.3.0-alpha11
public final boolean[] getBooleanArrayOrNull(@NonNull String key)

Retrieves a BooleanArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
boolean[]

The value associated with the key, or null if no valid value is found.

getBooleanOrNull

Added in 1.3.0-alpha11
public final Boolean getBooleanOrNull(@NonNull String key)

Retrieves a Boolean value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
Boolean

The value associated with the key, or null if no valid value is found.

getChar

Added in 1.3.0-alpha11
public final char getChar(@NonNull String key)

Retrieves a Char value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
char

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharArray

Added in 1.3.0-alpha11
public final @NonNull char[] getCharArray(@NonNull String key)

Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull char[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharArrayOrNull

Added in 1.3.0-alpha11
public final char[] getCharArrayOrNull(@NonNull String key)

Retrieves a CharArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
char[]

The value associated with the key, or null if no valid value is found.

getCharOrNull

Added in 1.3.0-alpha11
public final Character getCharOrNull(@NonNull String key)

Retrieves a Char value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
Character

The value associated with the key, or null if no valid value is found.

getCharSequence

Added in 1.3.0-alpha11
public final @NonNull CharSequence getCharSequence(@NonNull String key)

Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull CharSequence

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharSequenceArray

Added in 1.3.0-alpha11
public final @NonNull CharSequence[] getCharSequenceArray(@NonNull String key)

Retrieves an Array of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

Returns
@NonNull CharSequence[]

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharSequenceArrayOrNull

Added in 1.3.0-alpha11
public final CharSequence[] getCharSequenceArrayOrNull(@NonNull String key)

Retrieves an Array of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
CharSequence[]

The values associated with the key, or null if no valid value is found.

getCharSequenceList

Added in 1.3.0-alpha11
public final @NonNull List<@NonNull CharSequencegetCharSequenceList(@NonNull String key)

Retrieves a List of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

Returns
@NonNull List<@NonNull CharSequence>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharSequenceListOrNull

Added in 1.3.0-alpha11
public final List<@NonNull CharSequencegetCharSequenceListOrNull(@NonNull String key)

Retrieves a List of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
List<@NonNull CharSequence>

The values associated with the key, or null if no valid value is found.

getCharSequenceOrNull

Added in 1.3.0-alpha11
public final CharSequence getCharSequenceOrNull(@NonNull String key)

Retrieves a CharSequence value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
CharSequence

The value associated with the key, or null if no valid value is found.

getDouble

Added in 1.3.0-alpha11
public final double getDouble(@NonNull String key)

Retrieves a Double value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
double

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getDoubleArray

Added in 1.3.0-alpha11
public final @NonNull double[] getDoubleArray(@NonNull String key)

Retrieves a DoubleArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull double[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getDoubleArrayOrNull

Added in 1.3.0-alpha11
public final double[] getDoubleArrayOrNull(@NonNull String key)

Retrieves a DoubleArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
double[]

The value associated with the key, or null if no valid value is found.

getDoubleOrNull

Added in 1.3.0-alpha11
public final Double getDoubleOrNull(@NonNull String key)

Retrieves a Double value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
Double

The value associated with the key, or null if no valid value is found.

getFloat

Added in 1.3.0-alpha11
public final float getFloat(@NonNull String key)

Retrieves a Float value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
float

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getFloatArray

Added in 1.3.0-alpha11
public final @NonNull float[] getFloatArray(@NonNull String key)

Retrieves a FloatArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull float[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getFloatArrayOrNull

Added in 1.3.0-alpha11
public final float[] getFloatArrayOrNull(@NonNull String key)

Retrieves a FloatArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
float[]

The value associated with the key, or null if no valid value is found.

getFloatOrNull

Added in 1.3.0-alpha11
public final Float getFloatOrNull(@NonNull String key)

Retrieves a Float value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
Float

The value associated with the key, or null if no valid value is found.

getInt

Added in 1.3.0-alpha11
public final int getInt(@NonNull String key)

Retrieves an Int value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
int

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getIntArray

Added in 1.3.0-alpha11
public final @NonNull int[] getIntArray(@NonNull String key)

Retrieves a IntArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull int[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getIntArrayOrNull

Added in 1.3.0-alpha11
public final int[] getIntArrayOrNull(@NonNull String key)

Retrieves a IntArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
int[]

The value associated with the key, or null if no valid value is found.

getIntList

Added in 1.3.0-alpha11
public final @NonNull List<@NonNull IntegergetIntList(@NonNull String key)

Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

Returns
@NonNull List<@NonNull Integer>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getIntListOrNull

Added in 1.3.0-alpha11
public final List<@NonNull IntegergetIntListOrNull(@NonNull String key)

Retrieves a List of Int values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
List<@NonNull Integer>

The values associated with the key, or null if no valid value is found.

getIntOrNull

Added in 1.3.0-alpha11
public final Integer getIntOrNull(@NonNull String key)

Retrieves an Int value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
Integer

The value associated with the key, or null if no valid value is found.

getJavaSerializable

public final @NonNull T <T extends Serializable> getJavaSerializable(@NonNull String key)

Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Serializable>

The expected type of the value.

@NonNull String key

The key to retrieve the value for.

Returns
@NonNull T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getJavaSerializable

Added in 1.3.0-alpha11
public final @NonNull T <T extends Serializable> getJavaSerializable(
    @NonNull String key,
    @NonNull KClass<@NonNull T> serializableClass
)

Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull KClass<@NonNull T> serializableClass

The expected type of the value.

Returns
@NonNull T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getJavaSerializableOrNull

public final T <T extends Serializable> getJavaSerializableOrNull(@NonNull String key)

Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Serializable>

The expected type of the value.

@NonNull String key

The key to retrieve the value for.

Returns
T

The value associated with the key, or null if no valid value is found.

getJavaSerializableOrNull

Added in 1.3.0-alpha11
public final T <T extends Serializable> getJavaSerializableOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> serializableClass
)

Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull KClass<@NonNull T> serializableClass

The expected type of the value.

Returns
T

The value associated with the key, or null if no valid value is found.

getLong

Added in 1.3.0-alpha11
public final long getLong(@NonNull String key)

Retrieves a Long value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
long

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getLongArray

Added in 1.3.0-alpha11
public final @NonNull long[] getLongArray(@NonNull String key)

Retrieves a LongArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull long[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getLongArrayOrNull

Added in 1.3.0-alpha11
public final long[] getLongArrayOrNull(@NonNull String key)

Retrieves a LongArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
long[]

The value associated with the key, or null if no valid value is found.

getLongOrNull

Added in 1.3.0-alpha11
public final Long getLongOrNull(@NonNull String key)

Retrieves a Long value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
Long

The value associated with the key, or null if no valid value is found.

getParcelable

public final @NonNull T <T extends Parcelable> getParcelable(@NonNull String key)

Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Parcelable>

The expected type of the value.

@NonNull String key

The key to retrieve the value for.

Returns
@NonNull T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelable

Added in 1.3.0-alpha11
public final @NonNull T <T extends Parcelable> getParcelable(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull KClass<@NonNull T> parcelableClass

The expected type of the value.

Returns
@NonNull T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableArray

public final @NonNull T[] <T extends Parcelable> getParcelableArray(@NonNull String key)

Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Parcelable>

The expected type of the values.

@NonNull String key

The key to retrieve the values for.

Returns
@NonNull T[]

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableArray

Added in 1.3.0-alpha11
public final @NonNull T[] <T extends Parcelable> getParcelableArray(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

@NonNull KClass<@NonNull T> parcelableClass

The expected type of the values.

Returns
@NonNull T[]

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableArrayOrNull

public final T[] <T extends Parcelable> getParcelableArrayOrNull(@NonNull String key)

Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Parcelable>

The expected type of the values.

@NonNull String key

The key to retrieve the values for.

Returns
T[]

The values associated with the key, or null if no valid value is found.

getParcelableArrayOrNull

Added in 1.3.0-alpha11
public final T[] <T extends Parcelable> getParcelableArrayOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

@NonNull KClass<@NonNull T> parcelableClass

The expected type of the values.

Returns
T[]

The values associated with the key, or null if no valid value is found.

getParcelableList

public final @NonNull List<@NonNull T> <T extends Parcelable> getParcelableList(@NonNull String key)

Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Parcelable>

The expected type of the values.

@NonNull String key

The key to retrieve the values for.

Returns
@NonNull List<@NonNull T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableList

Added in 1.3.0-alpha11
public final @NonNull List<@NonNull T> <T extends Parcelable> getParcelableList(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

@NonNull KClass<@NonNull T> parcelableClass

The expected type of the values.

Returns
@NonNull List<@NonNull T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableListOrNull

public final List<@NonNull T> <T extends Parcelable> getParcelableListOrNull(@NonNull String key)

Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Parcelable>

The expected type of the values.

@NonNull String key

The key to retrieve the values for.

Returns
List<@NonNull T>

The value associated with the key, or null if no valid value is found.

getParcelableListOrNull

Added in 1.3.0-alpha11
public final List<@NonNull T> <T extends Parcelable> getParcelableListOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

@NonNull KClass<@NonNull T> parcelableClass

The expected type of the values.

Returns
List<@NonNull T>

The values associated with the key, or null if no valid value is found.

getParcelableOrNull

public final T <T extends Parcelable> getParcelableOrNull(@NonNull String key)

Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Parcelable>

The expected type of the value.

@NonNull String key

The key to retrieve the value for.

Returns
T

The value associated with the key, or null if no valid value is found.

getParcelableOrNull

Added in 1.3.0-alpha11
public final T <T extends Parcelable> getParcelableOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull KClass<@NonNull T> parcelableClass

The expected type of the value.

Returns
T

The value associated with the key, or null if no valid value is found.

getSavedState

Added in 1.3.0-alpha11
public final @NonNull SavedState getSavedState(@NonNull String key)

Retrieves a SavedState value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull SavedState

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSavedStateArray

Added in 1.3.0-alpha11
public final @NonNull SavedState[] getSavedStateArray(@NonNull String key)

Retrieves an Array of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

Returns
@NonNull SavedState[]

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSavedStateArrayOrNull

Added in 1.3.0-alpha11
public final SavedState[] getSavedStateArrayOrNull(@NonNull String key)

Retrieves an Array of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

Returns
SavedState[]

The values associated with the key, or null if no valid value is found.

getSavedStateList

Added in 1.3.0-alpha11
public final @NonNull List<@NonNull SavedStategetSavedStateList(@NonNull String key)

Retrieves a List of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

Returns
@NonNull List<@NonNull SavedState>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSavedStateListOrNull

Added in 1.3.0-alpha11
public final List<@NonNull SavedStategetSavedStateListOrNull(@NonNull String key)

Retrieves a List of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
List<@NonNull SavedState>

The values associated with the key, or null if no valid value is found.

getSavedStateOrNull

Added in 1.3.0-alpha11
public final SavedState getSavedStateOrNull(@NonNull String key)

Retrieves a SavedState value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
SavedState

The value associated with the key, or null if no valid value is found.

getSize

Added in 1.3.0-alpha11
public final @NonNull Size getSize(@NonNull String key)

Retrieves a Size value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull Size

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSizeF

Added in 1.3.0-alpha11
public final @NonNull SizeF getSizeF(@NonNull String key)

Retrieves a SizeF value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull SizeF

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSizeFOrNull

Added in 1.3.0-alpha11
public final SizeF getSizeFOrNull(@NonNull String key)

Retrieves a SizeF value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
SizeF

The value associated with the key, or null if no valid value is found.

getSizeOrNull

Added in 1.3.0-alpha11
public final Size getSizeOrNull(@NonNull String key)

Retrieves a Size value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
Size

The value associated with the key, or null if no valid value is found.

getSparseParcelableArray

public final @NonNull SparseArray<@NonNull T> <T extends Parcelable> getSparseParcelableArray(@NonNull String key)

Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Parcelable>

The expected type of the values.

@NonNull String key

The key to retrieve the values for.

Returns
@NonNull SparseArray<@NonNull T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSparseParcelableArray

Added in 1.3.0-alpha11
public final @NonNull SparseArray<@NonNull T> <T extends Parcelable> getSparseParcelableArray(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

@NonNull KClass<@NonNull T> parcelableClass

The expected type of the values.

Returns
@NonNull SparseArray<@NonNull T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSparseParcelableArrayOrNull

public final SparseArray<@NonNull T> <T extends Parcelable> getSparseParcelableArrayOrNull(@NonNull String key)

Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T extends Parcelable>

The expected type of the values.

@NonNull String key

The key to retrieve the values for.

Returns
SparseArray<@NonNull T>

The values associated with the key, or null if no valid value is found.

getSparseParcelableArrayOrNull

Added in 1.3.0-alpha11
public final SparseArray<@NonNull T> <T extends Parcelable> getSparseParcelableArrayOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

@NonNull KClass<@NonNull T> parcelableClass

The expected type of the values.

Returns
SparseArray<@NonNull T>

The values associated with the key, or null if no valid value is found.

getString

Added in 1.3.0-alpha11
public final @NonNull String getString(@NonNull String key)

Retrieves a String value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull String

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getStringArray

Added in 1.3.0-alpha11
public final @NonNull String[] getStringArray(@NonNull String key)

Retrieves an Array of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

Returns
@NonNull String[]

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getStringArrayOrNull

Added in 1.3.0-alpha11
public final String[] getStringArrayOrNull(@NonNull String key)

Retrieves an Array of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
String[]

The values associated with the key, or null if no valid value is found.

getStringList

Added in 1.3.0-alpha11
public final @NonNull List<@NonNull StringgetStringList(@NonNull String key)

Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the values for.

Returns
@NonNull List<@NonNull String>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getStringListOrNull

Added in 1.3.0-alpha11
public final List<@NonNull StringgetStringListOrNull(@NonNull String key)

Retrieves a List of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
List<@NonNull String>

The values associated with the key, or null if no valid value is found.

getStringOrNull

Added in 1.3.0-alpha11
public final String getStringOrNull(@NonNull String key)

Retrieves a String value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
String

The value associated with the key, or null if no valid value is found.

isEmpty

Added in 1.3.0-alpha11
public final boolean isEmpty()

Checks if the SavedState is empty (contains no key-value pairs).

Returns
boolean

true if the SavedState is empty, false otherwise.

isNull

Added in 1.3.0-alpha11
public final boolean isNull(@NonNull String key)

Checks if the SavedState contains a null reference for the specified key.

Parameters
@NonNull String key

The key to check for.

Returns
boolean

true if the SavedState contains a null reference for the key, false otherwise.

size

Added in 1.3.0-alpha11
public final int size()

Returns the number of key-value pairs in the SavedState.

Returns
int

The size of the SavedState.

toMap

Added in 1.3.0-alpha11
public final @NonNull Map<@NonNull StringObjecttoMap()

Returns a new Map containing all key-value pairs from the SavedState.

The returned Map does not preserve the entry iteration order of the SavedState.

IMPORTANT: All values will be copied by reference, and values within the SavedState that are also a SavedState will NOT be converted to a Map.

Returns
@NonNull Map<@NonNull StringObject>

A Map containing all key-value pairs from the SavedState.