import java.lang.String; import java.util.Collections; import java.util.List; import java.util.ArrayList; public class HelloWorld { public class RwTest { public String name; public String value; public RwTest(String name, String value) { this.name = name; this.value = value; } public String toString() { return String.format("{\"type\": \"RwTest\",\"%s\": \"%s\"}", name, value); } } private List<RwTest> testList; public List<RwTest> getTestList() { return testList == null ? Collections.emptyList() : testList; } public HelloWorld() { this.testList = new ArrayList<>(); this.testList.add(new RwTest("test1", "Hello, World!")); this.testList.add(new RwTest("test1", "Hello, EugeneX!")); } public void run() { var t = getTestList(); System.out.println(t); } public static void main(String[] args) { (new HelloWorld()).run(); } }