Differences between a region.remove and a region. destroy
search cancel

Differences between a region.remove and a region. destroy

book

Article ID: 439102

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

Difference between the Region.remove and Region.destroy APIs is how they handle non-existent keys.


Resolution

The destroy(Object key) method throws an EntryNotFoundException if the specified key does not exist in the region. In contrast, remove(Object key) adheres to the standard java.util.Map interface semantics by simply returning null (or false for the key-value variant) when the key is not found, without throwing an exception.