# AppSearchBatchResult.Builder

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder#pubctors)\|[Methods](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder#inhmethods)  

# AppSearchBatchResult.Builder

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchBatchResult.Builder "View this page in Kotlin")\|Java

`
public
static
final

class
AppSearchBatchResult.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|--------------------------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.appsearch.AppSearchBatchResult.Builder\<KeyType, ValueType\> |

<br />

*** ** * ** ***

Builder for[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult)objects.

## Summary

|                                                                                                                                                                                                                                                                                 ### Public constructors                                                                                                                                                                                                                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder#Builder())`() ` Creates a new[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder).                                                                                                                                                                                                                                                                                                                                           |
| ` `[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder#Builder(android.app.appsearch.AppSearchBatchResult<KeyType,ValueType>))`(`[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult)`<KeyType, ValueType> appSearchBatchResult) ` Creates a new[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder)from the given[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult). |

|                                                                                                                                                                                                                                                 ### Public methods                                                                                                                                                                                                                                                 ||
|-------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult)`<KeyType, ValueType>` | ` `[build](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder#build())`() ` Builds an[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult)object from the contents of this[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder). |
| ` `[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder)`<KeyType, ValueType>`      | ` `[setFailure](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder#setFailure(KeyType,%20int,%20java.lang.String))`(KeyType key, int resultCode, `[String](https://developer.android.com/reference/java/lang/String)` errorMessage) ` Associates the`key`with the provided failure code and error message.                            |
| ` `[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder)`<KeyType, ValueType>`      | ` `[setResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder#setResult(KeyType,%20android.app.appsearch.AppSearchResult<ValueType>))`(KeyType key, `[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)`<ValueType> result) ` Associates the`key`with the provided`result`.         |
| ` `[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder)`<KeyType, ValueType>`      | ` `[setSuccess](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder#setSuccess(KeyType,%20ValueType))`(KeyType key, ValueType value) ` Associates the`key`with the provided successful return value.                                                                                                                                   |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Builder

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 17](https://developer.android.com/sdkExtensions)  

```
public Builder ()
```

Creates a new[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder).

<br />

### Builder

Added in[API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 17](https://developer.android.com/sdkExtensions)  

```
public Builder (AppSearchBatchResult<KeyType, ValueType> appSearchBatchResult)
```

Creates a new[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder)from the given[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult).

<br />

|                                     Parameters                                     ||
|------------------------|------------------------------------------------------------|
| `appSearchBatchResult` | `AppSearchBatchResult`: This value cannot be`null`. <br /> |

## Public methods

### build

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public AppSearchBatchResult<KeyType, ValueType> build ()
```

Builds an[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult)object from the contents of this[Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder).

<br />

|                                                                               Returns                                                                                ||
|----------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult)`<KeyType, ValueType>` | This value cannot be`null`. <br /> |

### setFailure

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder<KeyType, ValueType> setFailure (KeyType key, 
                int resultCode, 
                String errorMessage)
```

Associates the`key`with the provided failure code and error message.

Any previous mapping for a key, whether success or failure, is deleted.

This is a convenience function which is equivalent to`setResult(key,
AppSearchResult.newFailedResult(resultCode, errorMessage))`.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ||
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`          | `KeyType`: The key to associate the result with; usually corresponds to some identifier from the input like an ID or name. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `resultCode`   | `int`: One of the constants documented in[AppSearchResult.getResultCode()](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#getResultCode()). Value is[AppSearchResult.RESULT_OK](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_OK),[AppSearchResult.RESULT_UNKNOWN_ERROR](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_UNKNOWN_ERROR),[AppSearchResult.RESULT_INTERNAL_ERROR](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_INTERNAL_ERROR),[AppSearchResult.RESULT_INVALID_ARGUMENT](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_INVALID_ARGUMENT),[AppSearchResult.RESULT_IO_ERROR](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_IO_ERROR),[AppSearchResult.RESULT_OUT_OF_SPACE](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_OUT_OF_SPACE),[AppSearchResult.RESULT_NOT_FOUND](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_NOT_FOUND),[AppSearchResult.RESULT_INVALID_SCHEMA](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_INVALID_SCHEMA),[AppSearchResult.RESULT_SECURITY_ERROR](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_SECURITY_ERROR),[AppSearchResult.RESULT_DENIED](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_DENIED),[AppSearchResult.RESULT_RATE_LIMITED](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_RATE_LIMITED),[AppSearchResult.RESULT_ALREADY_EXISTS](https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_ALREADY_EXISTS), android.app.appsearch.AppSearchResult.RESULT_ABORTED, or android.app.appsearch.AppSearchResult.RESULT_UNAVAILABLE <br /> |
| `errorMessage` | `String`: An optional string describing the reason or nature of the failure. This value may be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

|                                                                             Returns                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder)`<KeyType, ValueType>` | This value cannot be`null`. <br /> |

### setResult

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder<KeyType, ValueType> setResult (KeyType key, 
                AppSearchResult<ValueType> result)
```

Associates the`key`with the provided`result`.

Any previous mapping for a key, whether success or failure, is deleted.

<br />

|                                                                               Parameters                                                                                ||
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`    | `KeyType`: The key to associate the result with; usually corresponds to some identifier from the input like an ID or name. This value cannot be`null`. <br /> |
| `result` | `AppSearchResult`: The result to associate with the key. This value cannot be`null`. <br />                                                                   |

|                                                                             Returns                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder)`<KeyType, ValueType>` | This value cannot be`null`. <br /> |

### setSuccess

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder<KeyType, ValueType> setSuccess (KeyType key, 
                ValueType value)
```

Associates the`key`with the provided successful return value.

Any previous mapping for a key, whether success or failure, is deleted.

This is a convenience function which is equivalent to`setResult(key,
AppSearchResult.newSuccessfulResult(value))`.

<br />

|                                                                               Parameters                                                                               ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`   | `KeyType`: The key to associate the result with; usually corresponds to some identifier from the input like an ID or name. This value cannot be`null`. <br /> |
| `value` | `ValueType`: An optional value to associate with the successful result of the operation being performed. This value may be`null`. <br />                      |

|                                                                             Returns                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder)`<KeyType, ValueType>` | This value cannot be`null`. <br /> |