langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPool.java
changeset 42827 36468b5fa7f4
parent 42822 a84956e7ee4d
equal deleted inserted replaced
42826:563b42fc70ba 42827:36468b5fa7f4
   311         }
   311         }
   312         throw new EntryNotFound(value);
   312         throw new EntryNotFound(value);
   313     }
   313     }
   314 
   314 
   315     public Iterable<CPInfo> entries() {
   315     public Iterable<CPInfo> entries() {
   316         return new Iterable<CPInfo>() {
   316         return () -> new Iterator<CPInfo>() {
   317             public Iterator<CPInfo> iterator() {
   317 
   318                 return new Iterator<CPInfo>() {
   318             public boolean hasNext() {
   319 
   319                 return next < pool.length;
   320                     public boolean hasNext() {
       
   321                         return next < pool.length;
       
   322                     }
       
   323 
       
   324                     public CPInfo next() {
       
   325                         current = pool[next];
       
   326                         switch (current.getTag()) {
       
   327                             case CONSTANT_Double:
       
   328                             case CONSTANT_Long:
       
   329                                 next += 2;
       
   330                                 break;
       
   331                             default:
       
   332                                 next += 1;
       
   333                         }
       
   334                         return current;
       
   335                     }
       
   336 
       
   337                     public void remove() {
       
   338                         throw new UnsupportedOperationException();
       
   339                     }
       
   340 
       
   341                     private CPInfo current;
       
   342                     private int next = 1;
       
   343 
       
   344                 };
       
   345             }
   320             }
       
   321 
       
   322             public CPInfo next() {
       
   323                 current = pool[next];
       
   324                 switch (current.getTag()) {
       
   325                     case CONSTANT_Double:
       
   326                     case CONSTANT_Long:
       
   327                         next += 2;
       
   328                         break;
       
   329                     default:
       
   330                         next += 1;
       
   331                 }
       
   332                 return current;
       
   333             }
       
   334 
       
   335             public void remove() {
       
   336                 throw new UnsupportedOperationException();
       
   337             }
       
   338 
       
   339             private CPInfo current;
       
   340             private int next = 1;
       
   341 
   346         };
   342         };
   347     }
   343     }
   348 
   344 
   349     private CPInfo[] pool;
   345     private CPInfo[] pool;
   350 
   346