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 IBinder

Retrieves an IBinder object associated with the specified key.

final @NonNull IBinder
getBinderOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull IBinder> defaultValue
)

Retrieves an IBinder value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final boolean

Retrieves a Boolean value associated with the specified key.

final @NonNull boolean[]

Retrieves a BooleanArray value associated with the specified key.

final @NonNull boolean[]
getBooleanArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull boolean[]> defaultValue
)

Retrieves a BooleanArray value associated with the specified key, or a default value if the key doesn't exist.

final boolean
getBooleanOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Boolean> defaultValue
)

Retrieves a Boolean value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final char

Retrieves a Char value associated with the specified key.

final @NonNull char[]

Retrieves a CharArray value associated with the specified key.

final @NonNull char[]
getCharArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull char[]> defaultValue
)

Retrieves a CharArray value associated with the specified key, or a default value if the key doesn't exist.

final char
getCharOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Character> defaultValue
)

Retrieves a Char value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final @NonNull CharSequence

Retrieves a CharSequence value associated with the specified key.

final @NonNull CharSequence[]

Retrieves a CharArray value associated with the specified key.

final @NonNull CharSequence[]
getCharSequenceArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull CharSequence[]> defaultValue
)

Retrieves a CharArray value associated with the specified key, or a default value if the key doesn't exist.

final @NonNull List<@NonNull CharSequence>

Retrieves a List of elements of CharArray associated with the specified key.

final @NonNull List<@NonNull CharSequence>
getCharSequenceListOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull List<@NonNull CharSequence>> defaultValue
)

Retrieves a List of elements of CharSequence associated with the specified key, or a default value if the key doesn't exist.

final @NonNull CharSequence
getCharSequenceOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull CharSequence> defaultValue
)

Retrieves a CharSequence value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final double

Retrieves a Double value associated with the specified key.

final @NonNull double[]

Retrieves a DoubleArray value associated with the specified key.

final @NonNull double[]
getDoubleArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull double[]> defaultValue
)

Retrieves a DoubleArray value associated with the specified key, or a default value if the key doesn't exist.

final double
getDoubleOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Double> defaultValue
)

Retrieves a Double value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final float

Retrieves a Float value associated with the specified key.

final @NonNull float[]

Retrieves a FloatArray value associated with the specified key.

final @NonNull float[]
getFloatArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull float[]> defaultValue
)

Retrieves a FloatArray value associated with the specified key, or a default value if the key doesn't exist.

final float
getFloatOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Float> defaultValue
)

Retrieves a Float value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final int

Retrieves an Int value associated with the specified key.

final @NonNull int[]

Retrieves a IntArray value associated with the specified key.

final @NonNull int[]
getIntArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull int[]> defaultValue
)

Retrieves a IntArray value associated with the specified key, or a default value if the key doesn't exist.

final @NonNull List<@NonNull Integer>

Retrieves a List of elements of Int associated with the specified key.

final @NonNull List<@NonNull Integer>
getIntListOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull List<@NonNull Integer>> defaultValue
)

Retrieves a List of elements of Int associated with the specified key, or a default value if the key doesn't exist.

final int
getIntOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Integer> defaultValue
)

Retrieves a Int value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final @NonNull T

Retrieves a Serializable object associated with the specified key.

final @NonNull T
<T extends Serializable> getJavaSerializableOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull T> defaultValue
)

Retrieves a Serializable value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final long

Retrieves an Long value associated with the specified key.

final @NonNull long[]

Retrieves a LongArray value associated with the specified key.

final @NonNull long[]
getLongArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull long[]> defaultValue
)

Retrieves a LongArray value associated with the specified key, or a default value if the key doesn't exist.

final long
getLongOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Long> defaultValue
)

Retrieves a Long value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

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

Retrieves a Parcelable object associated with the specified key.

final @NonNull T[]

Retrieves an Array of elements of Parcelable associated with the specified key.

final @NonNull T[]
<T extends Parcelable> getParcelableArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull T[]> defaultValue
)

Retrieves a Array of elements of Parcelable associated with the specified key, or a default value if the key doesn't exist.

final @NonNull List<@NonNull T>

Retrieves a List of elements of Parcelable associated with the specified key.

final @NonNull List<@NonNull T>
<T extends Parcelable> getParcelableListOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull List<@NonNull T>> defaultValue
)

Retrieves a List of elements of Parcelable associated with the specified key, or a default value if the key doesn't exist.

final @NonNull T
<T extends Parcelable> getParcelableOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull T> defaultValue
)

Retrieves a Parcelable value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final @NonNull SavedState

Retrieves a SavedState object associated with the specified key.

final @NonNull SavedState
getSavedStateOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull SavedState> defaultValue
)

Retrieves a SavedState object associated with the specified key, or a default value if the key doesn't exist.

final @NonNull Size

Retrieves a Size object associated with the specified key.

final @NonNull SizeF

Retrieves a SizeF object associated with the specified key.

final @NonNull SizeF
getSizeFOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull SizeF> defaultValue
)

Retrieves a SizeF value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final @NonNull Size
getSizeOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Size> defaultValue
)

Retrieves a Size value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

final @NonNull SparseArray<@NonNull T>

Retrieves a SparseArray of elements of Parcelable associated with the specified key.

final @NonNull SparseArray<@NonNull T>
<T extends Parcelable> getSparseParcelableArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull SparseArray<@NonNull T>> defaultValue
)

Retrieves a SparseArray of elements of Parcelable associated with the specified key, or a default value if the key doesn't exist.

final @NonNull String

Retrieves a String value associated with the specified key.

final @NonNull String[]

Retrieves a Array of String value associated with the specified key.

final @NonNull String[]
getStringArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull String[]> defaultValue
)

Retrieves a Array of String value associated with the specified key, or a default value if the key doesn't exist.

final @NonNull List<@NonNull String>

Retrieves a List of elements of String associated with the specified key.

final @NonNull List<@NonNull String>
getStringListOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull List<@NonNull String>> defaultValue
)

Retrieves a List of elements of String associated with the specified key, or a default value if the key doesn't exist.

final @NonNull String
getStringOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull String> defaultValue
)

Retrieves a String value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

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-alpha06
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-alpha06
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.

getBinder

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

Retrieves an IBinder object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull IBinder

The value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getBinderOrElse

public final @NonNull IBinder getBinderOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull IBinder> defaultValue
)

Retrieves an IBinder value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull IBinder> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull IBinder

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getBoolean

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

Retrieves a Boolean value associated with the specified key.

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.

getBooleanArray

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

Retrieves a BooleanArray value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getBooleanArrayOrElse

Added in 1.3.0-alpha06
public final @NonNull boolean[] getBooleanArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull boolean[]> defaultValue
)

Retrieves a BooleanArray value associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull boolean[]> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull boolean[]

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getBooleanOrElse

Added in 1.3.0-alpha06
public final boolean getBooleanOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Boolean> defaultValue
)

Retrieves a Boolean value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull Boolean> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
boolean

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getChar

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

Retrieves a Char value associated with the specified key.

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.

getCharArray

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

Retrieves a CharArray value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getCharArrayOrElse

Added in 1.3.0-alpha06
public final @NonNull char[] getCharArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull char[]> defaultValue
)

Retrieves a CharArray value associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull char[]> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull char[]

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getCharOrElse

Added in 1.3.0-alpha06
public final char getCharOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Character> defaultValue
)

Retrieves a Char value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull Character> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
char

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getCharSequence

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

Retrieves a CharSequence value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getCharSequenceArray

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

Retrieves a CharArray value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getCharSequenceArrayOrElse

Added in 1.3.0-alpha06
public final @NonNull CharSequence[] getCharSequenceArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull CharSequence[]> defaultValue
)

Retrieves a CharArray value associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull CharSequence[]> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull CharSequence[]

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getCharSequenceList

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

Retrieves a List of elements of CharArray associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull CharSequence>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalStateException

if associated value has wrong type.

getCharSequenceListOrElse

public final @NonNull List<@NonNull CharSequencegetCharSequenceListOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull List<@NonNull CharSequence>> defaultValue
)

Retrieves a List of elements of CharSequence associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull List<@NonNull CharSequence>> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull List<@NonNull CharSequence>

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getCharSequenceOrElse

public final @NonNull CharSequence getCharSequenceOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull CharSequence> defaultValue
)

Retrieves a CharSequence value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull CharSequence> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull CharSequence

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getDouble

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

Retrieves a Double value associated with the specified key.

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.

getDoubleArray

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

Retrieves a DoubleArray value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getDoubleArrayOrElse

Added in 1.3.0-alpha06
public final @NonNull double[] getDoubleArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull double[]> defaultValue
)

Retrieves a DoubleArray value associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull double[]> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull double[]

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getDoubleOrElse

Added in 1.3.0-alpha06
public final double getDoubleOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Double> defaultValue
)

Retrieves a Double value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull Double> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
double

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getFloat

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

Retrieves a Float value associated with the specified key.

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.

getFloatArray

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

Retrieves a FloatArray value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getFloatArrayOrElse

Added in 1.3.0-alpha06
public final @NonNull float[] getFloatArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull float[]> defaultValue
)

Retrieves a FloatArray value associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull float[]> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull float[]

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getFloatOrElse

Added in 1.3.0-alpha06
public final float getFloatOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Float> defaultValue
)

Retrieves a Float value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull Float> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
float

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getInt

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

Retrieves an Int value associated with the specified key.

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.

getIntArray

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

Retrieves a IntArray value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getIntArrayOrElse

Added in 1.3.0-alpha06
public final @NonNull int[] getIntArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull int[]> defaultValue
)

Retrieves a IntArray value associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull int[]> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull int[]

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getIntList

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

Retrieves a List of elements of Int associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull Integer>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalStateException

if associated value has wrong type.

getIntListOrElse

Added in 1.3.0-alpha06
public final @NonNull List<@NonNull IntegergetIntListOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull List<@NonNull Integer>> defaultValue
)

Retrieves a List of elements of Int associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull List<@NonNull Integer>> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull List<@NonNull Integer>

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getIntOrElse

Added in 1.3.0-alpha06
public final int getIntOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Integer> defaultValue
)

Retrieves a Int value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull Integer> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
int

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getJavaSerializable

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

Retrieves a Serializable object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull T

The value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getJavaSerializableOrElse

public final @NonNull T <T extends Serializable> getJavaSerializableOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull T> defaultValue
)

Retrieves a Serializable value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull T> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull T

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getLong

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

Retrieves an Long value associated with the specified key.

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.

getLongArray

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

Retrieves a LongArray value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getLongArrayOrElse

Added in 1.3.0-alpha06
public final @NonNull long[] getLongArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull long[]> defaultValue
)

Retrieves a LongArray value associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull long[]> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull long[]

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getLongOrElse

Added in 1.3.0-alpha06
public final long getLongOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Long> defaultValue
)

Retrieves a Long value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull Long> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
long

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getParcelable

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

Retrieves a Parcelable object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull T

The value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getParcelableArray

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

Retrieves an Array of elements of Parcelable associated with the specified key.

Parameters
@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.IllegalStateException

if associated value has wrong type.

getParcelableArrayOrElse

public final @NonNull T[] <T extends Parcelable> getParcelableArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull T[]> defaultValue
)

Retrieves a Array of elements of Parcelable associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull T[]> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull T[]

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getParcelableList

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

Retrieves a List of elements of Parcelable associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull T>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalStateException

if associated value has wrong type.

getParcelableListOrElse

public final @NonNull List<@NonNull T> <T extends Parcelable> getParcelableListOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull List<@NonNull T>> defaultValue
)

Retrieves a List of elements of Parcelable associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull List<@NonNull T>> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull List<@NonNull T>

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getParcelableOrElse

public final @NonNull T <T extends Parcelable> getParcelableOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull T> defaultValue
)

Retrieves a Parcelable value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull T> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull T

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getSavedState

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

Retrieves a SavedState object associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getSavedStateOrElse

public final @NonNull SavedState getSavedStateOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull SavedState> defaultValue
)

Retrieves a SavedState object associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull SavedState> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull SavedState

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getSize

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

Retrieves a Size object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull Size

The value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getSizeF

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

Retrieves a SizeF object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull SizeF

The value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getSizeFOrElse

Added in 1.3.0-alpha06
public final @NonNull SizeF getSizeFOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull SizeF> defaultValue
)

Retrieves a SizeF value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull SizeF> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull SizeF

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getSizeOrElse

Added in 1.3.0-alpha06
public final @NonNull Size getSizeOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull Size> defaultValue
)

Retrieves a Size value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull Size> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull Size

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getSparseParcelableArray

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

Retrieves a SparseArray of elements of Parcelable associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull SparseArray<@NonNull T>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalStateException

if associated value has wrong type.

getSparseParcelableArrayOrElse

public final @NonNull SparseArray<@NonNull T> <T extends Parcelable> getSparseParcelableArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull SparseArray<@NonNull T>> defaultValue
)

Retrieves a SparseArray of elements of Parcelable associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull SparseArray<@NonNull T>> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull SparseArray<@NonNull T>

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getString

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

Retrieves a String value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getStringArray

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

Retrieves a Array of String value associated with the specified key.

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.IllegalStateException

if associated value has wrong type.

getStringArrayOrElse

Added in 1.3.0-alpha06
public final @NonNull String[] getStringArrayOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull String[]> defaultValue
)

Retrieves a Array of String value associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull String[]> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull String[]

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getStringList

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

Retrieves a List of elements of String associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull String>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalStateException

if associated value has wrong type.

getStringListOrElse

Added in 1.3.0-alpha06
public final @NonNull List<@NonNull StringgetStringListOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull List<@NonNull String>> defaultValue
)

Retrieves a List of elements of String associated with the specified key, or a default value if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull List<@NonNull String>> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull List<@NonNull String>

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

getStringOrElse

Added in 1.3.0-alpha06
public final @NonNull String getStringOrElse(
    @NonNull String key,
    @NonNull Function0<@NonNull String> defaultValue
)

Retrieves a String value associated with the specified key, or returns defaultValue if the key is not found or the associated value has the wrong type.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull Function0<@NonNull String> defaultValue

A function providing the default value to return if the key is not found or the associated value has the wrong type.

Returns
@NonNull String

The value associated with the key, or the result of defaultValue if the key is not found or the associated value has the wrong type.

isEmpty

Added in 1.3.0-alpha06
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-alpha06
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-alpha06
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-alpha06
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.