List 轉換成List


//將listmap轉換成list實體類
        List<OaAttachment>list=new ArrayList<OaAttachment>();
        if(Func.isNotEmpty(attachments)){
            for(Map<String,Object> map:attachments){
                OaAttachment fileInfo=new OaAttachment();
                fileInfo= JSONObject.parseObject(JSONObject.toJSONString(map),OaAttachment.class);
                list.add(fileInfo);
            }
        }

//將list實體類轉換成list map

List<Map<String,Object>>mapList=new ArrayList<>();
            for(OaAttachmentContract files:bean.getAttachments()){
                Map<String,Object>map=new HashMap<String,Object>();
                map=JSONObject.parseObject(JSONObject.toJSONString(files),Map.class);
                mapList.add(map);
            }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。