paul paul - 1 month ago 6
Scala Question

delete this please

This question is not longer valid and because seems people getting annoying, it would be good if can be deleted


Can val jsonAlbum= new JSONObject(json.asInstanceOf[Map[String, Any]]) throw NoSuchElementException? If not, just declare jsonAlbum before that try/catch block. If yes, you wouldn't see correct value of jsonAlbum in catch block anyway, because it's creation failed.

Note that you can use something like

val a = try { ... } catch { ... }

if you want to keep visibility without code garbage.