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 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 a default value if the key doesn't exist.

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 a default value if the key doesn't exist.

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 a default value if the key doesn't exist.

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 a default value if the key doesn't exist.

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 an Int value associated with the specified key, or a default value if the key doesn't exist.

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 an Int value associated with the specified key, or a default value if the key doesn't exist.

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

Retrieves a Parcelable object associated with the specified key.

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 object associated with the specified key, or a default value if the key doesn't exist.

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 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 a default value if the key doesn't exist.

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

getBoolean

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

Retrieves a Boolean value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
boolean

The Boolean value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getBooleanArray

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

Retrieves a BooleanArray value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull boolean[]

The BooleanArray value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getBooleanArrayOrElse

Added in 1.3.0-alpha05
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 if the key is not found.

Returns
@NonNull boolean[]

The BooleanArray value associated with the key, or the default value if the key is not found.

getBooleanOrElse

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

Retrieves a Boolean 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 if the key is not found.

Returns
boolean

The Boolean value associated with the key, or the default value if the key is not found.

getChar

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

Retrieves a Char value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
char

The Char value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getCharArray

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

Retrieves a CharArray value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull char[]

The CharArray value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getCharArrayOrElse

Added in 1.3.0-alpha05
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 if the key is not found.

Returns
@NonNull char[]

The CharArray value associated with the key, or the default value if the key is not found.

getCharOrElse

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

Retrieves a Char 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 Character> defaultValue

A function providing the default value if the key is not found.

Returns
char

The Char value associated with the key, or the default value if the key is not found.

getDouble

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

Retrieves a Double value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
double

The Double value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getDoubleArray

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

Retrieves a DoubleArray value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull double[]

The DoubleArray value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getDoubleArrayOrElse

Added in 1.3.0-alpha05
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 if the key is not found.

Returns
@NonNull double[]

The DoubleArray value associated with the key, or the default value if the key is not found.

getDoubleOrElse

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

Retrieves a Double 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 if the key is not found.

Returns
double

The Double value associated with the key, or the default value if the key is not found.

getFloat

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

Retrieves a Float value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
float

The Float value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getFloatArray

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

Retrieves a FloatArray value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull float[]

The FloatArray value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getFloatArrayOrElse

Added in 1.3.0-alpha05
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 if the key is not found.

Returns
@NonNull float[]

The FloatArray value associated with the key, or the default value if the key is not found.

getFloatOrElse

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

Retrieves a Float 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 if the key is not found.

Returns
float

The Float value associated with the key, or the default value if the key is not found.

getInt

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

Retrieves an Int value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
int

The Int value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getIntArray

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

Retrieves a IntArray value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull int[]

The IntArray value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getIntArrayOrElse

Added in 1.3.0-alpha05
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 if the key is not found.

Returns
@NonNull int[]

The IntArray value associated with the key, or the default value if the key is not found.

getIntList

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

Retrieves a List of elements of Int associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull Integer>

The List of elements of Int associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getIntListOrElse

Added in 1.3.0-alpha05
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 if the key is not found or the retrieved value is not a list of Int.

Returns
@NonNull List<@NonNull Integer>

The list of elements of Int associated with the key, or the default value if the key is not found.

getIntOrElse

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

Retrieves an Int 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 Integer> defaultValue

A function providing the default value if the key is not found.

Returns
int

The Int value associated with the key, or the default value if the key is not found.

getLong

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

Retrieves an Long value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
long

The Long value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getLongArray

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

Retrieves a LongArray value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull long[]

The LongArray value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getLongArrayOrElse

Added in 1.3.0-alpha05
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 if the key is not found.

Returns
@NonNull long[]

The LongArray value associated with the key, or the default value if the key is not found.

getLongOrElse

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

Retrieves an Int 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 if the key is not found.

Returns
long

The Int value associated with the key, or the default value if the key is not found.

getParcelable

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

Retrieves a Parcelable object associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull T

The Parcelable object associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

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. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull T>

The List of elements of Parcelable associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

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 if the key is not found or the retrieved value is not a list of Parcelable.

Returns
@NonNull List<@NonNull T>

The list of elements of Parcelable associated with the key, or the default value if the key is not found.

getParcelableOrElse

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

Retrieves a Parcelable 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 T> defaultValue

A function providing the default Parcelable if the key is not found.

Returns
@NonNull T

The Parcelable object associated with the key, or the default value if the key is not found.

getSavedState

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

Retrieves a SavedState object associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull SavedState

The SavedState object associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

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 SavedState if the key is not found.

Returns
@NonNull SavedState

The SavedState object associated with the key, or the default value if the key is not found.

getString

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

Retrieves a String value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull String

The String value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getStringArray

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

Retrieves a Array of String value associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull String[]

The Array of String value associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getStringArrayOrElse

Added in 1.3.0-alpha05
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 if the key is not found.

Returns
@NonNull String[]

The Array of String value associated with the key, or the default value if the key is not found.

getStringList

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

Retrieves a List of elements of String associated with the specified key. Throws an IllegalStateException if the key doesn't exist.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull String>

The List of elements of String associated with the key.

Throws
kotlin.IllegalStateException

If the key is not found.

getStringListOrElse

Added in 1.3.0-alpha05
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 if the key is not found or the retrieved value is not a list of String.

Returns
@NonNull List<@NonNull String>

The list of elements of String associated with the key, or the default value if the key is not found.

getStringOrElse

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

Retrieves a 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 if the key is not found.

Returns
@NonNull String

The String value associated with the key, or the default value if the key is not found.

isEmpty

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