0

i have a Map like

Map <String, List<Object>> timeSerisData

which contains two lists one is headerList and another is dataList but internally dataList contains another Objects, means my dataList is list of Objects. So now i am getting that headerList and dataList like this:

@PostMapping("/doExportData")
@Timed
public void doExportData(@Valid @RequestBody Map <String, List<Object>> 
timeSerisData){
    List<Object> headerList = new ArrayList<>();
    List<Object> dataList = new ArrayList<>();
            for(Map.Entry<String, List<Object>> entry : 
            timeSerisData.entrySet()) {

        if(entry.getKey() == "headerData") {

            headerList = entry.getValue();
            System.out.println("headerlist"+headerList);

        }else {

            if(entry.getKey() == "dataList") {

                dataList = entry.getValue();
                System.out.println("data list"+dataList);
            }

        }

    }
}

In above code in dataList i am getting list which contains two objects like this:[{Ticker=GSU,Name=Revenu,Year=2015, dataList=[1,2,3,4,5,6]}, {Ticker=GSU, Name=Gross,Year=2018, dataList=[7,8,9,10,11,12]}]

Now i want to get the values of this dataList and want to set that in pojo class. So how to get those values.

  • you probably do not want to compare strings using the ```==``` operator. Instead I think you want to use the ```String.equals(otherString)``` method of the String class. See https://stackoverflow.com/questions/7520432/what-is-the-difference-between-vs-equals-in-java – luksch Apr 14 '18 at 15:31
  • Do you want to dynamically create a pojo class, or is your dataList of a defined format and you can define the structure of that pojo class in advance? – luksch Apr 14 '18 at 15:37

0 Answers0