From dce4e463d95f4fff7cd1808f1d7eafc79ac8eda8 Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Fri, 16 Dec 2011 04:55:54 +0000 Subject: [PATCH] Apply variable name improvement from issue 385. Fixes issue 385. --- .../examples/rawcollections/RawCollectionsExample.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/extras/src/main/java/com/google/gson/extras/examples/rawcollections/RawCollectionsExample.java b/extras/src/main/java/com/google/gson/extras/examples/rawcollections/RawCollectionsExample.java index adad4bc8..3d595cda 100644 --- a/extras/src/main/java/com/google/gson/extras/examples/rawcollections/RawCollectionsExample.java +++ b/extras/src/main/java/com/google/gson/extras/examples/rawcollections/RawCollectionsExample.java @@ -23,8 +23,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonParser; public class RawCollectionsExample { - public static final String json = "['hello',5,{name:'GREETINGS',source:'guest'}]"; - static class Event { private String name; private String source; @@ -37,7 +35,7 @@ public class RawCollectionsExample { return String.format("(name=%s, source=%s)", name, source); } } - + @SuppressWarnings("unchecked") public static void main(String[] args) { Gson gson = new Gson(); @@ -45,8 +43,8 @@ public class RawCollectionsExample { collection.add("hello"); collection.add(5); collection.add(new Event("GREETINGS", "guest")); - String json2 = gson.toJson(collection); - System.out.println("Using Gson.toJson() on a raw collection: " + json2); + String json = gson.toJson(collection); + System.out.println("Using Gson.toJson() on a raw collection: " + json); JsonParser parser = new JsonParser(); JsonArray array = parser.parse(json).getAsJsonArray(); String message = gson.fromJson(array.get(0), String.class);