java 中bug:Return an empty array rather than null. 解决
Posted alextongtong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java 中bug:Return an empty array rather than null. 解决相关的知识,希望对你有一定的参考价值。
CODE
private static File[] foo()
return Collections.emptyList().toArray(new File[0]);
private static File[] bar()
return new File[0];
想要返回一个empty 的array的方式:
private static final File[] NO_FILES = ;
private static File[] bar()
return NO_FILES;
以上是关于java 中bug:Return an empty array rather than null. 解决的主要内容,如果未能解决你的问题,请参考以下文章
IllegalArgumentException: Can not create a Path from an empty string
suggest braces around empty body in an 'if' statement
no crontab for root - using an empty one 888
[解决方案]spark 2.4 报错:grouping expressions sequence is empty, *** is not an aggregate function.
Adding ASP.NET Identity to an Empty or Existing Web Forms Project