# Class AbstractDataStore&lt;V&gt; (2.1.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.1.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.store.AbstractDataStore)
- [2.0.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/2.0.3/com.google.api.client.util.store.AbstractDataStore)
- [1.47.1](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.47.1/com.google.api.client.util.store.AbstractDataStore)
- [1.46.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.46.3/com.google.api.client.util.store.AbstractDataStore)
- [1.45.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.45.3/com.google.api.client.util.store.AbstractDataStore)
- [1.44.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.44.2/com.google.api.client.util.store.AbstractDataStore)
- [1.43.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.43.2/com.google.api.client.util.store.AbstractDataStore)
- [1.42.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.42.3/com.google.api.client.util.store.AbstractDataStore)
- [1.41.8](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.41.8/com.google.api.client.util.store.AbstractDataStore)

    public abstract class AbstractDataStore<V> implements DataStore<V>

Abstract data store implementation.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> AbstractDataStore\<V\>

## Implements

com.google.api.client.util.store.DataStore\<V\>

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `V` |   |

## Constructors

### AbstractDataStore(DataStoreFactory dataStoreFactory, String id)

    protected AbstractDataStore(DataStoreFactory dataStoreFactory, String id)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `dataStoreFactory` | `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.store.DataStoreFactory` data store factory |
| `id` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` data store ID |

## Methods

### containsKey(String key)

    public boolean containsKey(String key)

Returns whether the store contains the given key.

Default implementation is to call #get(String) and check if it is `null`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `key` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### containsValue(V value)

    public boolean containsValue(V value)

Returns whether the store contains the given value.

Default implementation is to call Collection#contains(Object) on #values().

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `V` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### getDataStoreFactory()

    public DataStoreFactory getDataStoreFactory()

Returns the data store factory.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.store.DataStoreFactory` |   |

### getId()

    public final String getId()

Returns the data store ID.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### isEmpty()

    public boolean isEmpty()

Returns whether there are any stored keys.

Default implementation is to check if [#size()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.store.AbstractDataStore#com_google_api_client_util_store_AbstractDataStore_size__) is `0`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### size()

    public int size()

Returns the number of stored keys.

Default implementation is to call Set#size() on #keySet().

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |