# Pools.SimplePool

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/Pools.kt+class:androidx.core.util.Pools.SimplePool) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
public class Pools.SimplePool<T extends Object> implements Pools.Pool<@NonNull T>
```

<br />

Known direct subclasses [Pools.SynchronizedPool](https://developer.android.com/reference/androidx/core/util/Pools.SynchronizedPool)

|---|---|
| `https://developer.android.com/reference/androidx/core/util/Pools.SynchronizedPool` | Synchronized pool of objects. |

*** ** * ** ***

Simple (non-synchronized) pool of objects.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | The pooled type. |

## Summary

| ### Public constructors |
|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/core/util/Pools.SimplePool#SimplePool(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) int maxPoolSize)` |

| ### Public methods |
|---|---|
| `T` | `https://developer.android.com/reference/androidx/core/util/Pools.SimplePool#acquire()()` |
| `boolean` | `https://developer.android.com/reference/androidx/core/util/Pools.SimplePool#release(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull T instance)` Release an instance to the pool. |

## Public constructors

### SimplePool

```
public <T extends Object> SimplePool(@IntRange(from = 1) int maxPoolSize)
```

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | The pooled type. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) int maxPoolSize` | The maximum pool size |

## Public methods

### acquire

```
public T acquire()
```

| Returns |
|---|---|
| `T` | An instance from the pool if such, null otherwise. |

### release

```
public boolean release(@NonNull T instance)
```

Release an instance to the pool.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull T instance` | The instance to release. |

| Returns |
|---|---|
| `boolean` | Whether the instance was put in the pool. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | If the instance is already in the pool. |