Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
Map<String, Integer> map = new HashMap<>();
|
||||
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
Map<String, Integer> map = new TreeMap<>(comparator);
|
||||
|
|
@ -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;
|
||||
};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
map.put("rosetta", 100);
|
||||
map.put("code", 200);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
int valueA = map.get("rosetta");
|
||||
int valueB = map.get("code");
|
||||
|
|
@ -0,0 +1 @@
|
|||
map.replace("rosetta", 300);
|
||||
|
|
@ -0,0 +1 @@
|
|||
boolean replaced = map.replace("rosetta", 100, 300);
|
||||
|
|
@ -0,0 +1 @@
|
|||
boolean contains = map.containsKey("rosetta");
|
||||
|
|
@ -0,0 +1 @@
|
|||
boolean contains = map.containsValue(100);
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Map<String, Integer> map = new LinkedHashMap<>();
|
||||
map.put("rosetta", 100);
|
||||
map.put("code", 200);
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Map<String, Integer> map = new TreeMap<>();
|
||||
map.put("rosetta", 100);
|
||||
map.put("code", 200);
|
||||
Loading…
Add table
Add a link
Reference in a new issue