Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,5 @@
Map<String, Int> map = new HashMap();
map["foo"] = 5; // or: map.put("foo", 5)
map["bar"] = 10;
map["baz"] = 15;
map["foo"] = 6; // replaces previous value of 5

View file

@ -0,0 +1 @@
Map<String, Int> map = ["foo"=6, "bar"=10, "baz"=15];

View file

@ -0,0 +1,7 @@
Int? mightBeNull = map["foo"];
Int neverNull = map.getOrDefault("foo", 0);
if (Int n := map.get("foo")) {
// if "foo" is in the map, then the variable "n" is set to its value
} else {
// if "foo" is not in the map, then the variable "n" is not defined
}

View file

@ -0,0 +1,3 @@
for (String key : map) {
// the variable "key" is defined here
}

View file

@ -0,0 +1,3 @@
for (Int value : map.values) {
// the variable "value" is defined here
}

View file

@ -0,0 +1,3 @@
for ((String key, Int value) : map) {
// the variables "key" and "value" are defined here
}