Java 如何创建和访问列表列表的列表。。在爪哇?

Java 如何创建和访问列表列表的列表。。在爪哇?,java,json,list,Java,Json,List,我有一个来自JSON的对象,我想访问多个数组中的元素。 我从JSON生成Dto中带有getter和setter的类 它给了我一个公共类型 List getCoordinates() 如何获取元素的坐标 我试着这样做,但它不起作用。Georgeferencias是我的对象json GeoReferencias geoReferencias = new GeoReferencias(); for(Geometry geometry : geoReferencias.getFeatures().get

我有一个来自JSON的对象,我想访问多个数组中的元素。 我从JSON生成Dto中带有getter和setter的类 它给了我一个公共类型
List getCoordinates()

如何获取元素的坐标

我试着这样做,但它不起作用。Georgeferencias是我的对象json

GeoReferencias geoReferencias = new GeoReferencias();
for(Geometry geometry : geoReferencias.getFeatures().get().getGeometry()) {
    geometry.getCoordinates();
}
JSON数据:

{
    "type": "Feature",
    "id": 426,
    "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
        [
            [
                [
                    20.90620040893566,
                    -11.984783172607422
                ],
                [
                    20.901933670044002,
                    -11.982872009277344
                ]
            ]
        ]
    }
}
列表列表->列表
List <List <List <List <Double> >>> getCoordinates = new ArrayList<>();

for(int i = 0 ; i <getCoordinates.size()  ; i++){
     Double cordinate[] = new Double[2];// if you have only 2 cordinates
     List <List <List <Double> >> a = getCoordinates.get(i)

     for(int j = 0 ; j <a.size()  ; j++){
         List <List <Double> > b = a.get(j);

         for(int k = 0 ; k <b.size()  ; k++){
            List <Double>  c = b.get(k);

            for(int l = 0 ; l <c.size()  ; l++){
                Double[l] =  c.get(l);
            }
        }
    }
    //perform your action related to coordinates over here because it will re-initialize as its inside loop.
}
Double arr[] = new int[2];
arr[0] = getCoordinates.get(fixed_index).get(fixed_index).get(fixed_index).get(0);
arr[1] = getCoordinates.get(fixed_index).get(fixed_index).get(fixed_index).get(1);