Comparison of enums values() method and class.getEnumConstants()
问题 I'm trying to compare this two ways to achieving the enums values (with and without reflection). So this is my test class: public class ReflectionOnEnumsTests2 { enum TestEnum { ONE, TWO, THREE; } public static void main(String[] args) { long n = 600_000_000; int stub; //test without Reflection long timeStartWithoutReflection = System.currentTimeMillis(); for (int i = 0; i < n; i++){ TestEnum[] values = TestEnum.values(); stub = values.length; } System.out.println("Time consuming with