aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/orddict.erl
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-10-22 09:53:52 +0200
committerFredrik Gustafsson <[email protected]>2013-10-22 09:53:52 +0200
commitaa3d0613b1e67f378ee11838f67e7cfbe1bc5928 (patch)
tree10bf9be0748bf57d5ed4d7b78ab1417b834ce10d /lib/stdlib/src/orddict.erl
parenta6141d40a3596090c41f7e52537eaab2e733510c (diff)
parente6757fb65ef28f6b4b16d626f119bd162c415a81 (diff)
downloadotp-aa3d0613b1e67f378ee11838f67e7cfbe1bc5928.tar.gz
otp-aa3d0613b1e67f378ee11838f67e7cfbe1bc5928.tar.bz2
otp-aa3d0613b1e67f378ee11838f67e7cfbe1bc5928.zip
Merge branch 'mh/dict_orddict_is_empty/OTP-11353'
* mh/dict_orddict_is_empty/OTP-11353: Update primary bootstrap Add dict:is_empty/1 and orddict:is_empty/1
Diffstat (limited to 'lib/stdlib/src/orddict.erl')
-rw-r--r--lib/stdlib/src/orddict.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/stdlib/src/orddict.erl b/lib/stdlib/src/orddict.erl
index 45d3c84b3e..da60fc1bb6 100644
--- a/lib/stdlib/src/orddict.erl
+++ b/lib/stdlib/src/orddict.erl
@@ -20,7 +20,7 @@
-module(orddict).
%% Standard interface.
--export([new/0,is_key/2,to_list/1,from_list/1,size/1]).
+-export([new/0,is_key/2,to_list/1,from_list/1,size/1,is_empty/1]).
-export([fetch/2,find/2,fetch_keys/1,erase/2]).
-export([store/3,append/3,append_list/3,update/3,update/4,update_counter/3]).
-export([fold/3,map/2,filter/2,merge/3]).
@@ -64,6 +64,12 @@ from_list(Pairs) ->
size(D) -> length(D).
+-spec is_empty(Orddict) -> boolean() when
+ Orddict :: orddict().
+
+is_empty([]) -> true;
+is_empty([_|_]) -> false.
+
-spec fetch(Key, Orddict) -> Value when
Key :: term(),
Value :: term(),