2021年6月16日

Arrays.asList与Arrays.stream 创建长度为0的数组

摘要: 参考网址:https://www.cnblogs.com/baby123/p/12619872.html 创建长度为0的数组: public static void main(String args[]){ Integer[] integer = new Integer[0]; System.out 阅读全文

posted @ 2021-06-16 17:27 ~码铃薯~ 阅读(132) 评论(0) 推荐(0) 编辑

[B cannot be cast to java.lang.String

摘要: 出现这个问题的原因是,调用外部接口的时候,返回的报文是byte字节。 这个时候如果我们使用String直接进行转化的话,就会报这个错误, 正确的做法是:new String((byte[])result,StandardCharsets.UTF-8); 大概的意思是先获取byte的字节数组,然后再转 阅读全文

posted @ 2021-06-16 14:09 ~码铃薯~ 阅读(5100) 评论(0) 推荐(0) 编辑

java8中的Optional的使用

摘要: import java.util.Optional; public class TestOptional { public static void main(String[] args) { TestDemo testDemo = new TestDemo(); // testDemo.setCou 阅读全文

posted @ 2021-06-16 09:59 ~码铃薯~ 阅读(191) 评论(0) 推荐(0) 编辑

导航