[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  
Summary:[Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/MutableKeyValueStore#pubmethods)\|[Inherited Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/MutableKeyValueStore#inhmethods)  

# MutableKeyValueStore

`
public


interface
MutableKeyValueStore
`  
`


implements

`[KeyValueStore](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/KeyValueStore)`


`

|-----------------------------------------------------------------|
| android.adservices.ondevicepersonalization.MutableKeyValueStore |

<br />

*** ** * ** ***

An interface to a read-write key-value store. Used as a Data Access Object for the LOCAL_DATA table.  
**See also:**

- [IsolatedService.getLocalData(RequestToken)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/IsolatedService#getLocalData(android.adservices.ondevicepersonalization.RequestToken))

## Summary

|                                                                                                                                                                ### Public methods                                                                                                                                                                 ||
|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract byte[]` | ` `[put](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/MutableKeyValueStore#put(java.lang.String,%20byte[]))`(`[String](https://developer.android.com/reference/java/lang/String)` key, byte[] value) ` Associates the specified value with the specified key. |
| ` abstract byte[]` | ` `[remove](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/MutableKeyValueStore#remove(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` key) ` Removes the mapping for the specified key.                               |

| ### Inherited methods |
|-----------------------|---|
| From interface` `[android.adservices.ondevicepersonalization.KeyValueStore](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/KeyValueStore)` ` |--------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract byte[]`                                                                                                                               | ` `[get](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/KeyValueStore#get(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` key) ` Looks up a key in a read-only store. | | ` abstract `[Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | ` `[keySet](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/KeyValueStore#keySet())`() ` Returns a Set view of the keys contained in the REMOTE_DATA table.                                                     | ||

## Public methods

### put

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

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

<br />

|                                                  Parameters                                                  ||
|---------|-----------------------------------------------------------------------------------------------------|
| `key`   | `String`: key with which the specified value is to be associated This value cannot be`null`. <br /> |
| `value` | `byte`: value to be associated with the specified key This value cannot be`null`. <br />            |

|                                              Returns                                              ||
|----------|-----------------------------------------------------------------------------------------|
| `byte[]` | the previous value associated with key, or null if there was no mapping for key. <br /> |

### remove

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

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

<br />

|                                       Parameters                                       ||
|-------|---------------------------------------------------------------------------------|
| `key` | `String`: key whose mapping is to be removed This value cannot be`null`. <br /> |

|                                              Returns                                              ||
|----------|-----------------------------------------------------------------------------------------|
| `byte[]` | the previous value associated with key, or null if there was no mapping for key. <br /> |