JAva奇数回と偶数回で異なる操作を行う

802 ワード

        ,     
int i=0;
for(Map tid:lists){
    Integer tableid = (Integer) tid.get("tableid");
    AttributeInfo attributeInfo = layoutService.queryTableInfoByTid(tableid);
    Integer outType = attributeInfo.getOut_type();
    //  :tid
    if(i%2==0){
        leftObject += "{\"id\":"+tableid+",\"outtype\":"+outType+"}";
    }else{
        rightObject += "{\"id\":"+tableid+",\"outtype\":"+outType+"}";
    }
    i++;
    object = "{\"object\":["+leftObject+","+rightObject+"]}";
    model.addAttribute("object",object);
}