# Class FieldValue (3.43.1)

3.43.1 (latest) 3.41.0 3.38.0 3.37.0 3.36.0 3.35.1 3.33.4 3.32.2 3.31.9 3.30.11 3.28.0 3.27.2 3.26.5 3.25.1 3.24.3 3.22.0 3.21.4 3.20.0 3.17.0 3.16.3 3.15.7 3.14.4 3.13.2 3.12.1 3.11.0 3.10.0 3.9.6 3.8.2 3.7.10 3.6.0 3.5.0 3.4.2 3.3.0 3.2.0 3.1.0 3.0.21

    public abstract class FieldValue

Sentinel values that can be used when writing document fields with set() or update().

## Inheritance

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

## 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-)

## Static Methods

### arrayRemove(Object\[\] elements)

    public static FieldValue arrayRemove(Object[] elements)

Returns a special value that can be used with set(), create() or update() that tells the server
to remove the given elements from any array value that already exists on the server. All
instances of each element specified will be removed from the array. If the field being modified
is not already an array it will be overwritten with an empty array.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `elements` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html[]` The elements to remove from the array. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` | The FieldValue sentinel for use in a call to set() or update(). |

### arrayUnion(Object\[\] elements)

    public static FieldValue arrayUnion(Object[] elements)

Returns a special value that can be used with set(), create() or update() that tells the server
to union the given elements with any array value that already exists on the server. Each
specified element that doesn't already exist in the array will be added to the end. If the
field being modified is not already an array it will be overwritten with an array containing
exactly the specified elements.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `elements` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html[]` The elements to union into the array. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` | The FieldValue sentinel for use in a call to set() or update(). |

### delete()

    public static FieldValue delete()

Returns a sentinel used with update() to mark a field for deletion.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` |   |

### increment(double d)

    public static FieldValue increment(double d)

Returns a special value that can be used with set(), create() or update() that tells the server
to increment the field's current value by the given value.

If the current value is an integer or a double, both the current and the given value will be
interpreted as doubles and all arithmetic will follow IEEE 754 semantics. Otherwise, the
transformation will set the field to the given value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `d` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` | The FieldValue sentinel for use in a call to set(), create() or update(). |

### increment(long l)

    public static FieldValue increment(long l)

Returns a special value that can be used with set(), create() or update() that tells the server
to increment the field's current value by the given value.

If the current field value is an integer, possible integer overflows are resolved to
Long.MAX_VALUE or Long.MIN_VALUE. If the current field value is a double, both values will be
interpreted as doubles and the arithmetic will follow IEEE 754 semantics.

If the current field is not an integer or double, or if the field does not yet exist, the
transformation will set the field to the given value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `l` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` | The FieldValue sentinel for use in a call to set(), create() or update(). |

### maximum(double d)

    public static FieldValue maximum(double d)

Returns a special value that can be used with set(), create() or update() that tells the server
to set the field to the numeric maximum of the field's current and the given value.

If the current field value is not of type 'number', or if the field does not yet exist, the
transformation will set the field to the given value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `d` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` | The FieldValue sentinel for use in a call to set(), create() or update(). |

### maximum(long l)

    public static FieldValue maximum(long l)

Returns a special value that can be used with set(), create() or update() that tells the server
to set the field to the numeric maximum of the field's current and the given value.

If the current field value is not of type 'number', or if the field does not yet exist, the
transformation will set the field to the given value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `l` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` | The FieldValue sentinel for use in a call to set(), create() or update(). |

### minimum(double d)

    public static FieldValue minimum(double d)

Returns a special value that can be used with set(), create() or update() that tells the server
to set the field to the numeric minimum of the field's current and the given value.

If the current field value is not of type 'number', or if the field does not yet exist, the
transformation will set the field to the given value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `d` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` | The FieldValue sentinel for use in a call to set(), create() or update(). |

### minimum(long l)

    public static FieldValue minimum(long l)

Returns a special value that can be used with set(), create() or update() that tells the server
to set the field to the numeric minimum of the field's current and the given value.

If the current field value is not of type 'number', or if the field does not yet exist, the
transformation will set the field to the given value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `l` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` | The FieldValue sentinel for use in a call to set(), create() or update(). |

### serverTimestamp()

    public static FieldValue serverTimestamp()

Returns a sentinel used with set() or update() to include a server-generated timestamp in the
written data.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldValue` |   |

### vector(double\[\] values)

    public static VectorValue vector(double[] values)

Creates a new [VectorValue](https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.VectorValue) constructed with a copy of the given array of doubles.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `values` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html[]` Create a [VectorValue](https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.VectorValue) instance with a copy of this array of doubles. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.VectorValue` | A new [VectorValue](https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.VectorValue) constructed with a copy of the given array of doubles. |

## Methods

### equals(Object obj)

    public boolean equals(Object obj)

Returns true if this FieldValue is equal to the provided object.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `obj` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` The object to compare against. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether this FieldValue is equal to the provided object. |

**Overrides** [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)

### hashCode()

    public int hashCode()

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

**Overrides** [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)