---
title: "Do not check if List is empty"
url: "https://blog.beyondthecloud.dev/tips/do-not-check-if-list-is-empty"
category: "Apex"
published: "2024-01-02"
---

# Do not check if List is empty

DML operations on empty lists are NOT consuming the transaction DML limits?

### Do not check if List is empty

Did you know that:

DML operations on empty lists are NOT consuming the transaction DML limits?

```apex
List<Account> accountsToInsert = new List<Account>();
if (!accountsToInsert.isEmpty()) {
    insert accountsToInsert;
}
```

```apex
List<Account> accountsToInsert = new List<Account>();
insert accountsToInsert;
```
