Пример #1
0
 private static InstanceUtils getInstance(InstanceUtils iu, int n) {
   if (n == 1) {
     return iu;
   }
   return getInstance(iu.getInstance(InstanceUtils.class), n - 1);
 }
Пример #2
0
 private static int instances(InstanceUtils iu) {
   if (iu.instances.containsKey(InstanceUtils.class)) {
     return instances(iu.getInstance(InstanceUtils.class)) + 1;
   }
   return 1;
 }
Пример #3
0
 private int instance(InstanceUtils iu) {
   if (iu == this) {
     return 1;
   }
   return instance(iu.getInstance(InstanceUtils.class)) + 1;
 }