Send feedback
Interface DataStore<V> (1.43.2)
Stay organized with collections
Save and categorize content based on your preferences.
Version 1.43.2 keyboard_arrow_down
public interface DataStore<V>
Stores and manages serializable data of a specific type, where the key is a string and the value
is a Serializable object.
null
keys or values are not allowed. Implementation should be thread-safe.
Type Parameter
Name
Description
V
Methods
clear()
public abstract DataStore<V> clear ()
Deletes all of the stored keys and values.
containsKey(String key)
public abstract boolean containsKey ( String key )
Returns whether the store contains the given key.
Parameter
Name
Description
key
String
containsValue(V value)
public abstract boolean containsValue ( V value )
Returns whether the store contains the given value.
Parameter
Name
Description
value
V
delete(String key)
public abstract DataStore<V> delete ( String key )
Deletes the stored key and value based on the given key, or ignored if the key doesn't already
exist.
Parameter
Name
Description
key
String
key or null
to ignore
get(String key)
public abstract V get ( String key )
Returns the stored value for the given key or null
if not found.
Parameter
Name
Description
key
String
key or null
for null
result
Returns
Type
Description
V
getDataStoreFactory()
public abstract DataStoreFactory getDataStoreFactory ()
Returns the data store factory.
getId()
public abstract String getId ()
Returns the data store ID.
Returns
Type
Description
String
isEmpty()
public abstract boolean isEmpty ()
Returns whether there are any stored keys.
keySet()
public abstract Set<String> keySet ()
Returns the unmodifiable set of all stored keys.
Order of the keys is not specified.
set(String key, V value)
public abstract DataStore<V> set ( String key , V value )
Stores the given value for the given key (replacing any existing value).
Parameters
Name
Description
key
String
key
value
V
value object
size()
public abstract int size ()
Returns the number of stored keys.
Returns
Type
Description
int
values()
public abstract Collection<V> values ()
Returns the unmodifiable collection of all stored values.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-19 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-19 UTC."],[],[]]