CollectionNavType


public abstract class CollectionNavType<T extends Object> extends NavType


A NavType for Collection such as arrays, lists, maps.

Parameters
<T extends Object>

the type of the data that is supported by this NavType

Summary

Public constructors

<T extends Object> CollectionNavType(boolean isNullableAllowed)

Public methods

abstract @NonNull List<@NonNull String>

Serialize a value of this NavType into a list of String.

Inherited methods

From androidx.navigation.NavType
abstract T
get(@NonNull Bundle bundle, @NonNull String key)

Get a value of this type from the bundle

@NonNull String

The name of this type.

boolean

Check if an argument with this type can hold a null value.

abstract @NonNull T

Parse a value of this type from a String.

@NonNull T
parseValue(@NonNull String value, @NonNull T previousValue)

Parse a value of this type from a String and then combine that parsed value with the given previousValue of the same type to provide a new value that contains both the new and previous value.

abstract void
put(@NonNull Bundle bundle, @NonNull String key, @NonNull T value)

Put a value of this type in the bundle

@NonNull String

Serialize a value of this NavType into a String.

@NonNull String
boolean
valueEquals(@NonNull T value, @NonNull T other)

Compares two values of type T and returns true if values are equal.

Public constructors

CollectionNavType

public <T extends Object> CollectionNavType(boolean isNullableAllowed)
Parameters
<T extends Object>

the type of the data that is supported by this NavType

boolean isNullableAllowed

whether the argument of this type can hold a null value

Public methods

serializeAsValues

Added in 2.8.0-alpha07
public abstract @NonNull List<@NonNull StringserializeAsValues(@NonNull T value)

Serialize a value of this NavType into a list of String.

Each element in the collection should be converted to an individual String element of the returned list.

Parameters
@NonNull T value

a value of this NavType

Returns
@NonNull List<@NonNull String>

List containing serialized String representation of value