primitive maps final

This commit is contained in:
mherbaghinyan 2019-03-11 11:15:52 +04:00
parent 5ac596bbb9
commit 0530d5c59f
1 changed files with 9 additions and 15 deletions

View File

@ -21,37 +21,33 @@ public class PrimitiveMaps {
private static void fastutilMap() {
Int2BooleanMap int2BooleanMap = new Int2BooleanOpenHashMap();
int2BooleanMap.put(1, true);
int2BooleanMap.put(7, false);
int2BooleanMap.put(4, true);
boolean value = int2BooleanMap.get(1);
Int2BooleanSortedMap int2BooleanSorted = Int2BooleanSortedMaps.EMPTY_MAP;
int2BooleanSorted.putIfAbsent(7, true);
int2BooleanSorted.putIfAbsent(1, true);
int2BooleanSorted.putIfAbsent(4, true);
}
private static void coltMap() {
AbstractIntDoubleMap map = new OpenIntDoubleHashMap();
map.put(1, 4.5);
double value = map.get(1);
}
private static void eclipseCollectionsMap() {
MutableObjectDoubleMap<String> doubleMap = ObjectDoubleMaps.mutable.empty();
doubleMap.put("1", 1.0d);
doubleMap.put("2", 2.0d);
MutableObjectIntMap<String> booleanMap = ObjectIntMaps.mutable.empty();
booleanMap.put("ok", 1);
MutableIntIntMap mutableIntIntMap = IntIntMaps.mutable.empty();
mutableIntIntMap.addToValue(1, 1);
ImmutableIntIntMap immutableIntIntMap = IntIntMaps.immutable.empty();
MutableObjectIntMap<String> intObject = ObjectIntMaps.mutable.empty();
intObject.addToValue("price", 2);
MutableObjectDoubleMap<String> dObject = ObjectDoubleMaps.mutable.empty();
dObject.addToValue("price", 150.5);
dObject.addToValue("quality", 4.4);
dObject.addToValue("stability", 0.8);
}
private static void troveMap() {
double[] doubles = new double[] {1.2, 4.5, 0.3};
int[] ints = new int[] {1, 4, 0};
@ -60,7 +56,5 @@ public class PrimitiveMaps {
doubleIntMap.adjustValue(1.2, 1);
doubleIntMap.adjustValue(4.5, 4);
doubleIntMap.adjustValue(0.3, 0);
System.out.println(doubleIntMap);
}
}