UnsupportedOperation Exception while using Map in Java | Java Exceptions

Pubblicato il: 04 July 2023
sul canale di: Prashant Rana
109
6

You must have encountered UnsupportedOperation exception while using Map, whose stacktrace starts with:

Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractMap.put(AbstractMap.java:186)

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


In questa pagina del sito puoi guardare il video online UnsupportedOperation Exception while using Map in Java | Java Exceptions della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Prashant Rana 04 July 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 109 volte e gli è piaciuto 6 spettatori. Buona visione!