您不应该能够获得负载系数和容量。它们是hashmap类的实现细节。但是,您可以使用反射。尽量避免使用它,但这通常是一个坏主意。
Field f1 = m.getClass().getDeclaredField("table");f1.setAccessible(true);int capacity = f1.get(m).length;Field f2 = m.getClass().getDeclaredField("threshold");f2.setAccessible(true);int currentLoadFactor = f2.get(m);


