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 @@
Map<String, Integer> map = new HashMap<>();

View file

@ -0,0 +1,10 @@
Comparator<String> comparator = new Comparator<String>() {
public int compare(String stringA, String stringB) {
if (stringA.compareTo(stringB) > 0) {
return -1;
} else if (stringA.compareTo(stringB) < 0) {
return 1;
}
return 0;
}
};

View file

@ -0,0 +1 @@
Map<String, Integer> map = new TreeMap<>(comparator);

View file

@ -0,0 +1,8 @@
Comparator<String> comparator = (stringA, stringB) -> {
if (stringA.compareTo(stringB) > 0) {
return -1;
} else if (stringA.compareTo(stringB) < 0) {
return 1;
}
return 0;
};

View file

@ -0,0 +1,2 @@
map.put("rosetta", 100);
map.put("code", 200);

View file

@ -0,0 +1,2 @@
int valueA = map.get("rosetta");
int valueB = map.get("code");

View file

@ -0,0 +1 @@
map.replace("rosetta", 300);

View file

@ -0,0 +1 @@
boolean replaced = map.replace("rosetta", 100, 300);

View file

@ -0,0 +1 @@
boolean contains = map.containsKey("rosetta");

View file

@ -0,0 +1 @@
boolean contains = map.containsValue(100);

View file

@ -0,0 +1,3 @@
Map<String, Integer> map = new LinkedHashMap<>();
map.put("rosetta", 100);
map.put("code", 200);

View file

@ -0,0 +1,3 @@
Map<String, Integer> map = new TreeMap<>();
map.put("rosetta", 100);
map.put("code", 200);