diff options
author | Magnus Henoch <[email protected]> | 2013-09-04 14:08:34 +0100 |
---|---|---|
committer | Magnus Henoch <[email protected]> | 2013-09-13 10:44:23 +0100 |
commit | 0e4b0ae7ce57117a561f70fa51026d85b4702aaa (patch) | |
tree | 4a0aba55aaeef71d6f2abed3b8aec50cd0018c6a /lib/stdlib/doc/src | |
parent | 5b56a49d15d10ad4a35dbc8b2a4b01486f1d5294 (diff) | |
download | otp-0e4b0ae7ce57117a561f70fa51026d85b4702aaa.tar.gz otp-0e4b0ae7ce57117a561f70fa51026d85b4702aaa.tar.bz2 otp-0e4b0ae7ce57117a561f70fa51026d85b4702aaa.zip |
Add dict:is_empty/1 and orddict:is_empty/1
dict:size/1 runs in constant time, but orddict:size/1 does not. With
this change, the two modules stay API compatible and gain a
constant-time function for checking whether a dictionary is empty.
Diffstat (limited to 'lib/stdlib/doc/src')
-rw-r--r-- | lib/stdlib/doc/src/dict.xml | 7 | ||||
-rw-r--r-- | lib/stdlib/doc/src/orddict.xml | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/stdlib/doc/src/dict.xml b/lib/stdlib/doc/src/dict.xml index b8cf61af80..6ff81b56ee 100644 --- a/lib/stdlib/doc/src/dict.xml +++ b/lib/stdlib/doc/src/dict.xml @@ -177,6 +177,13 @@ merge(Fun, D1, D2) -> </desc> </func> <func> + <name name="is_empty" arity="1"/> + <fsummary>Return true if the dictionary is empty</fsummary> + <desc> + <p>Returns <c>true</c> if <c><anno>Dict</anno></c> has no elements, <c>false</c> otherwise.</p> + </desc> + </func> + <func> <name name="store" arity="3"/> <fsummary>Store a value in a dictionary</fsummary> <desc> diff --git a/lib/stdlib/doc/src/orddict.xml b/lib/stdlib/doc/src/orddict.xml index b6aee7a7d6..6d1702bc59 100644 --- a/lib/stdlib/doc/src/orddict.xml +++ b/lib/stdlib/doc/src/orddict.xml @@ -187,6 +187,13 @@ merge(Fun, D1, D2) -> </desc> </func> <func> + <name name="is_empty" arity="1"/> + <fsummary>Return true if the dictionary is empty</fsummary> + <desc> + <p>Returns <c>true</c> if <c><anno>Orddict</anno></c> has no elements, <c>false</c> otherwise.</p> + </desc> + </func> + <func> <name name="store" arity="3"/> <fsummary>Store a value in a dictionary</fsummary> <desc> |