从地图中获取第一个值和第二个值的最佳方法是什么。我正在尝试阅读tableLists
地图并first and second value
从地图中获取。
下面是我ReadTableConnectionInfo
的类代码。
private final LinkedHashMap<String, ReadTableConnectionInfo> tableLists;
ReadTableConnectionInfo table = tablePicker();
private ReadTableConnectionInfo tablePicker() {
Random r = new SecureRandom();
ReadTableConnectionInfo table;
if (r.nextFloat() < Read.percentageTable / 100) {
table = get first value from tableLists map
} else {
table = get second value from tableLists map
}
return table;
}