Inicialização mais fácil de objetos Java

Em vez de fazer isso: JsonObject obj = new JsonObject();obj.putString(“something”,”some string”);JsonObject childObj = new JsonObject();childObj.putString(“another thing”,”another string”);obj.putObject(“child”,childObj); …você consegue fazer isso: JsonObject obj = new JsonObject() {{ putString(“something”,”some string”); putObject(“child”, …

Continuar lendo