术语“长度”之间是否存在技术差异?和“大小” (在编程中,当然)? [英] Is there a technical difference between the terms "length" and "size" (in programming, of course)?

查看:156
本文介绍了术语“长度”之间是否存在技术差异?和“大小” (在编程中,当然)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

计数与长度对比集合中的大小

特别是在Java中,在字符串上,你调用 string.length(),而在列表您调用 list.size()。两个术语之间是否存在技术差异,因为 String 实际上只是字符列表

In Java in particular, on Strings, you call string.length(), whereas in Lists you call list.size(). Is there a technical difference between the two terms, seeing as a String is really just a list of chars?

赞赏任何评论。

推荐答案

理想情况下, count 将是项目数, size 将是占用的存储量(如 sizeof )。

Ideally, count would be the number of items, and size would be the amount of storage taken up (as in sizeof).

在实践中,所有三个(包括长度,这是最多的在许多广泛使用的图书馆中都存在着模糊不清的问题,因此在这个阶段试图对它们施加模式毫无意义。

In practice, all three (including length, which is the most ambiguous) are muddled up in many widely-used libraries, so there's no point trying to impose a pattern on them at this stage.

这篇关于术语“长度”之间是否存在技术差异?和“大小” (在编程中,当然)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆