將Object數組轉換為String數組


代碼如下

//設備總數
List<String> strList = devices.stream().map(Device::getDevice_id).collect(Collectors.toList());
//將Object數組轉換為String數組
String[] strByte = strList.toArray(new String[0]);
//將數組拼接成一個長的字符串
String devIds = String.join(",",strByte);

 歡迎關注作者微信公眾號

 


免責聲明!

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