# Enum DatastoreService.KeyRangeState (5.0.3)

    public enum DatastoreService.KeyRangeState extends Enum<DatastoreService.KeyRangeState>

Indicates the state of a [KeyRange](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.KeyRange).
See Also: [DatastoreService#allocateIdRange(KeyRange)](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.DatastoreService#com_google_appengine_api_datastore_DatastoreService_allocateIdRange_com_google_appengine_api_datastore_KeyRange_)

## Inherited Members

[Enum.\<T\>valueOf(Class\<T\>,String)](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#valueOf-java.lang.Class-java.lang.String-) [Enum.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#clone--) [Enum.compareTo(E)](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#compareTo-E-) [Enum.describeConstable()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#describeConstable--) [Enum.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#equals-java.lang.Object-) [Enum.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#finalize--) [Enum.getDeclaringClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#getDeclaringClass--) [Enum.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#hashCode--) [Enum.name()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#name--) [Enum.ordinal()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#ordinal--) [Enum.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#toString--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [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.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-)

| ## Static Fields ||
|---|---|
| **Name** | **Description** |
| `COLLISION` | Indicates that entities with keys inside the given [KeyRange](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.KeyRange) already exist and writing to this range will overwrite those entities. Additionally the implications of [#CONTENTION](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.DatastoreService.KeyRangeState#com_google_appengine_api_datastore_DatastoreService_KeyRangeState_CONTENTION) apply. If overwriting entities that exist in this range is acceptable it is safe to use the given range. The datastore's automatic ID allocator will never assign a key to a new entity that will overwrite an existing entity so entities written by the user to this range will never be overwritten by an entity with an automatically assigned key. |
| `CONTENTION` | Indicates the given [KeyRange](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.KeyRange) is empty but the datastore's automatic ID allocator may assign new entities keys in this range. However it is safe to manually assign [Keys](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Key) in this range if either of the following is true: - No other request will insert entities with the same kind and parent as the given [KeyRange](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.KeyRange) until all entities with manually assigned keys from this range have been written. - Overwriting entities written by other requests with the same kind and parent as the given [KeyRange](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.KeyRange) is acceptable. The datastore's automatic ID allocator will not assign a key to a new entity that will overwrite an existing entity, so once the range is populated there will no longer be any contention. |
| `EMPTY` | Indicates the given [KeyRange](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.KeyRange) is empty and the datastore's automatic ID allocator will not assign keys in this range to new entities. |

| ## Static Methods ||
|---|---|
| **Name** | **Description** |
| `valueOf(String name)` |   |
| `values()` |   |