但是,当处理数据集合时,零数组(返回零)和空数组(返回其本身)需要密切关注。
But when dealing with a collection of data, the distinction between a null array (which returns null) and an empty array (which returns itself) needs closer attention.
如果您返回零数组,该代码的客户端必须编写额外的代码来检查返回值是否为零(如清单13所示)。
If you return a null array, the clients of the code must write extra code to check whether the return value is null (as shown in Listing 13).
如果您返回零数组,该代码的客户端必须编写额外的代码来检查返回值是否为零(如清单13所示)。
If you return a null array, the clients of the code must write extra code to check whether the return value is null (as shown in Listing 13).
应用推荐