Stay organized with collections
Save and categorize content based on your preferences.
MutableKeyValueStore
public
interface
MutableKeyValueStore
implements
KeyValueStore
android.adservices.ondevicepersonalization.MutableKeyValueStore
|
An interface to a read-write key-value store.
Used as a Data Access Object for the LOCAL_DATA table.
Summary
Public methods |
abstract
byte[]
|
put(String key, byte[] value)
Associates the specified value with the specified key.
|
abstract
byte[]
|
remove(String key)
Removes the mapping for the specified key.
|
Public methods
put
public abstract byte[] put (String key,
byte[] value)
Associates the specified value with the specified key.
If a value already exists for that key, the old value is replaced.
This method may take several seconds to complete, so it should
only be called from a worker thread.
Parameters |
key |
String : key with which the specified value is to be associated
This value cannot be null . |
value |
byte : value to be associated with the specified key
This value cannot be null . |
Returns |
byte[] |
the previous value associated with key, or null if there was no mapping for key. |
remove
public abstract byte[] remove (String key)
Removes the mapping for the specified key.
This method may take several seconds to complete, so it should
only be called from a worker thread.
Parameters |
key |
String : key whose mapping is to be removed
This value cannot be null . |
Returns |
byte[] |
the previous value associated with key, or null if there was no mapping for key. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# MutableKeyValueStore\n\nAdded in [API level 35](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nMutableKeyValueStore\n====================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/adservices/ondevicepersonalization/MutableKeyValueStore \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\ninterface\nMutableKeyValueStore\n`\n\n\n`\n\n\nimplements\n\n`[KeyValueStore](/reference/android/adservices/ondevicepersonalization/KeyValueStore)`\n\n\n`\n\n|-----------------------------------------------------------------|\n| android.adservices.ondevicepersonalization.MutableKeyValueStore |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nAn interface to a read-write key-value store.\n\nUsed as a Data Access Object for the LOCAL_DATA table. \n**See also:**\n\n- [IsolatedService.getLocalData(RequestToken)](/reference/android/adservices/ondevicepersonalization/IsolatedService#getLocalData(android.adservices.ondevicepersonalization.RequestToken))\n\nSummary\n-------\n\n| ### Public methods ||\n|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract byte[]` | ` `[put](/reference/android/adservices/ondevicepersonalization/MutableKeyValueStore#put(java.lang.String,%20byte[]))`(`[String](/reference/java/lang/String)` key, byte[] value) ` Associates the specified value with the specified key. |\n| ` abstract byte[]` | ` `[remove](/reference/android/adservices/ondevicepersonalization/MutableKeyValueStore#remove(java.lang.String))`(`[String](/reference/java/lang/String)` key) ` Removes the mapping for the specified key. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[android.adservices.ondevicepersonalization.KeyValueStore](/reference/android/adservices/ondevicepersonalization/KeyValueStore)` ` |----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract byte[]` | ` `[get](/reference/android/adservices/ondevicepersonalization/KeyValueStore#get(java.lang.String))`(`[String](/reference/java/lang/String)` key) ` Looks up a key in a read-only store. | | ` abstract `[Set](/reference/java/util/Set)`\u003c`[String](/reference/java/lang/String)`\u003e` | ` `[keySet](/reference/android/adservices/ondevicepersonalization/KeyValueStore#keySet())`() ` Returns a Set view of the keys contained in the REMOTE_DATA table. | ||\n\nPublic methods\n--------------\n\n### put\n\nAdded in [API level 35](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract byte[] put (String key, \n byte[] value)\n```\n\nAssociates the specified value with the specified key.\nIf a value already exists for that key, the old value is replaced.\n\n\u003cbr /\u003e\n\n\nThis method may take several seconds to complete, so it should\nonly be called from a worker thread.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------------|\n| `key` | `String`: key with which the specified value is to be associated This value cannot be `null`. \u003cbr /\u003e |\n| `value` | `byte`: value to be associated with the specified key This value cannot be `null`. \u003cbr /\u003e |\n\n| Returns ||\n|----------|-----------------------------------------------------------------------------------------|\n| `byte[]` | the previous value associated with key, or null if there was no mapping for key. \u003cbr /\u003e |\n\n### remove\n\nAdded in [API level 35](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract byte[] remove (String key)\n```\n\nRemoves the mapping for the specified key.\n\n\u003cbr /\u003e\n\n\nThis method may take several seconds to complete, so it should\nonly be called from a worker thread.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------|----------------------------------------------------------------------------------|\n| `key` | `String`: key whose mapping is to be removed This value cannot be `null`. \u003cbr /\u003e |\n\n| Returns ||\n|----------|-----------------------------------------------------------------------------------------|\n| `byte[]` | the previous value associated with key, or null if there was no mapping for key. \u003cbr /\u003e |"]]