import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
public class HashMapTest {
public static void main(String[] args) throws Exception {
Map<String,Object> map = new HashMap<>(32,0.75F);
System.out.println(getField(map,"threshold"));
System.out.println(getMethod(map,"isEmpty"));
}
private static Object getField(Object obj,String f) throws Exception {
Field field = obj.getClass().getDeclaredField(f);
field.setAccessible(true);
return field.get(obj);
}
private static Object getMethod(Object obj,String m,Object ... args) throws Exception {
Method method = obj.getClass().getDeclaredMethod(m);
method.setAccessible(true);
return method.invoke(obj,args);
}
}