Size

trait~ Size

Source:

Trait to de­term­ine the size of a con­tainer.

Im­ple­men­ted at least for Ob­ject, String, Ar­ray, Map, Set.

In­ter­face

In­voc­a­tion takes the form (c: Con­tainer) => i: In­teger

Laws

  • i >= 0
  • i !== null && i !== un­defined.
  • Must be ef­fi­cient to ex­ecute. No IO, avoid bad al­gorithmic com­plex­it­ies.