CollectionsBag.java - Source code of artefact used in this tutorial
Given below is the source code of class com.techfundaes.gsonBag.CollectionsBag which is used in earlier examples.
package com.techfundaes.gsonBag; import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; import java.util.TreeMap; public class CollectionsBag { int[] years; ArrayList<String> userList = new ArrayList<String>(); Hashtable<String, String> deptMap = new Hashtable<String, String>(); TreeMap<String, String> gameAuthorMap = null; public CollectionsBag() { years = new int[] {2012, 2013}; userList.add("ABC"); userList.add("XYZ"); deptMap.put("logistics", "Amsterdam"); deptMap.put("sales", "Auckland"); } public String toString() { StringBuilder builder = new StringBuilder(); builder.append("CollectionsBag [years=").append(Arrays.toString(years)) .append(", userList=").append(userList).append(", deptMap=") .append(deptMap).append(", gameAuthorMap=") .append(gameAuthorMap).append("]"); return builder.toString(); } }