private static InstanceUtils getInstance(InstanceUtils iu, int n) { if (n == 1) { return iu; } return getInstance(iu.getInstance(InstanceUtils.class), n - 1); }
private static int instances(InstanceUtils iu) { if (iu.instances.containsKey(InstanceUtils.class)) { return instances(iu.getInstance(InstanceUtils.class)) + 1; } return 1; }
private int instance(InstanceUtils iu) { if (iu == this) { return 1; } return instance(iu.getInstance(InstanceUtils.class)) + 1; }