Archived
0

new module: utils

This commit is contained in:
2021-06-27 02:50:02 +03:00
parent bb3f0bbdcb
commit c189472244
6 changed files with 8 additions and 2 deletions

1
utils/build.gradle Normal file
View File

@@ -0,0 +1 @@
apply from: rootDir.toPath().resolve('logic.gradle').toFile()

2
utils/gradle.properties Normal file
View File

@@ -0,0 +1,2 @@
# suppress inspection "UnusedProperty" for whole file
module.name=utils

View File

@@ -0,0 +1,23 @@
package mc.utils;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
public class Table<C, R, V> {
private final Map<C, Map<R, V>> map = new HashMap<>();
@Nullable
public V getColumnAndRow(C column, R row) {
if (!map.containsKey(column)) {
return null;
}
return map.get(column).get(row);
}
public void put(C column, R row, V value) {
map.computeIfAbsent(column, c -> new HashMap<>()).put(row, value);
}
}