2015-01-25 17:42:36 -08:00
|
|
|
var map = {
|
|
|
|
|
"one": 1,
|
|
|
|
|
"two": 2,
|
|
|
|
|
"three": 3
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-15 07:46:09 -07:00
|
|
|
System.print(map.count) // expect: 3
|
|
|
|
|
System.print(map.remove("two")) // expect: 2
|
|
|
|
|
System.print(map.count) // expect: 2
|
|
|
|
|
System.print(map.remove("three")) // expect: 3
|
|
|
|
|
System.print(map.count) // expect: 1
|
2015-01-25 17:42:36 -08:00
|
|
|
|
|
|
|
|
// Remove an already removed entry.
|
2015-09-15 07:46:09 -07:00
|
|
|
System.print(map.remove("two")) // expect: null
|
|
|
|
|
System.print(map.count) // expect: 1
|
2015-01-25 17:42:36 -08:00
|
|
|
|
2015-09-15 07:46:09 -07:00
|
|
|
System.print(map.remove("one")) // expect: 1
|
|
|
|
|
System.print(map.count) // expect: 0
|