29 lines
585 B
Plaintext
29 lines
585 B
Plaintext
extend map {
|
|
function containsKey(key) {
|
|
return this.keys.contains(key);
|
|
}
|
|
|
|
function containsValue(value) {
|
|
return this.values.contains(value);
|
|
}
|
|
|
|
function contains(key, value) {
|
|
return (this as (v, k) ^ v % (k == key) and (v == value)).size > 0;
|
|
}
|
|
|
|
function isEmpty() {
|
|
return this.size == 0;
|
|
}
|
|
|
|
function isNotEmpty() {
|
|
return not this.isEmpty();
|
|
}
|
|
|
|
function getOrDefault(key, default) {
|
|
if(this.containsKey(key)) {
|
|
return this.get(key);
|
|
}
|
|
|
|
return default;
|
|
}
|
|
} |