fork(95) download
  1. import java.util.ArrayList;
  2. import java.util.HashMap;
  3. import java.util.List;
  4. import java.util.Map;
  5.  
  6. import com.adobe.cq.commerce.hybris.to.checkout.DefaultProductSelection;
  7. import com.google.gson.Gson;
  8.  
  9. public class test {
  10.  
  11. public static void main(String[] args) {
  12. Map<String, List<DefaultProductSelection>> defaultValues = new HashMap<String, List<DefaultProductSelection>>();
  13. DefaultProductSelection defaultProductSelection = new DefaultProductSelection();
  14. defaultProductSelection.setComponentId("componnetId1");
  15. defaultProductSelection.setProductCode("pCode1");
  16. List<DefaultProductSelection> obj = new ArrayList<DefaultProductSelection>();
  17. obj.add(defaultProductSelection);
  18. defaultValues.put("componnetId1", obj);
  19.  
  20. Gson gson = new Gson();
  21. System.out.println(gson.toJson(defaultValues));
  22.  
  23. }
  24.  
  25. }
  26.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:9: error: class test is public, should be declared in a file named test.java
public class test {
       ^
Main.java:6: error: package com.adobe.cq.commerce.hybris.to.checkout does not exist
import com.adobe.cq.commerce.hybris.to.checkout.DefaultProductSelection;
                                               ^
Main.java:7: error: package com.google.gson does not exist
import com.google.gson.Gson;
                      ^
Main.java:12: error: cannot find symbol
		Map<String, List<DefaultProductSelection>> defaultValues = new HashMap<String, List<DefaultProductSelection>>();
		                 ^
  symbol:   class DefaultProductSelection
  location: class test
Main.java:12: error: cannot find symbol
		Map<String, List<DefaultProductSelection>> defaultValues = new HashMap<String, List<DefaultProductSelection>>();
		                                                                                    ^
  symbol:   class DefaultProductSelection
  location: class test
Main.java:13: error: cannot find symbol
		DefaultProductSelection defaultProductSelection = new DefaultProductSelection();
		^
  symbol:   class DefaultProductSelection
  location: class test
Main.java:13: error: cannot find symbol
		DefaultProductSelection defaultProductSelection = new DefaultProductSelection();
		                                                      ^
  symbol:   class DefaultProductSelection
  location: class test
Main.java:16: error: cannot find symbol
		List<DefaultProductSelection> obj = new ArrayList<DefaultProductSelection>();
		     ^
  symbol:   class DefaultProductSelection
  location: class test
Main.java:16: error: cannot find symbol
		List<DefaultProductSelection> obj = new ArrayList<DefaultProductSelection>();
		                                                  ^
  symbol:   class DefaultProductSelection
  location: class test
Main.java:20: error: cannot find symbol
		Gson gson = new Gson();
		^
  symbol:   class Gson
  location: class test
Main.java:20: error: cannot find symbol
		Gson gson = new Gson();
		                ^
  symbol:   class Gson
  location: class test
11 errors
stdout
Standard output is empty