UnsupportedOperation Exception while using Map in Java | Java Exceptions

preview_player
Показать описание
You must have encountered UnsupportedOperation exception while using Map, whose stacktrace starts with:

The culprit is the emptyMap() API. The documentation for emptyMap() shows:

Returns the empty map (immutable). This map is serializable and there’s the catch- emptyMap returns immutable map and an put operation on immutable map results in UnsupportedOperation exception.

#java #exceptionhandlinginjava
Рекомендации по теме