Out of the following two option, which one do you prefer to init Gson object? Can someone help me understand the impact of both ways on Android app performance (start up time?), if there's any.
// inline creation
private final Gson gson = new Gson();
vs
// need base creation, overhead of sync everytime while accessing gson object
private synchronized Gson getOrCreateGson() {
gson == null ? gson = new Gson() : gson;
return gson.fromJson(jsonString, clazz);
}