src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java

Print this page




 110     }
 111 
 112     /**
 113      * Returns the last instruction in this list.
 114      *
 115      * @return the last instruction in this list, or <tt>null</tt> if the list
 116      *         is empty.
 117      */
 118     public AbstractInsnNode getLast() {
 119         return last;
 120     }
 121 
 122     /**
 123      * Returns the instruction whose index is given. This method builds a cache
 124      * of the instructions in this list to avoid scanning the whole list each
 125      * time it is called. Once the cache is built, this method run in constant
 126      * time. This cache is invalidated by all the methods that modify the list.
 127      *
 128      * @param index the index of the instruction that must be returned.
 129      * @return the instruction whose index is given.
 130      * @throws IndexOutOfBoundsException if (index < 0 || index >= size()).
 131      */
 132     public AbstractInsnNode get(final int index) {
 133         if (index < 0 || index >= size) {
 134             throw new IndexOutOfBoundsException();
 135         }
 136         if (cache == null) {
 137             cache = toArray();
 138         }
 139         return cache[index];
 140     }
 141 
 142     /**
 143      * Returns <tt>true</tt> if the given instruction belongs to this list.
 144      * This method always scans the instructions of this list until it finds the
 145      * given instruction or reaches the end of the list.
 146      *
 147      * @param insn an instruction.
 148      * @return <tt>true</tt> if the given instruction belongs to this list.
 149      */
 150     public boolean contains(final AbstractInsnNode insn) {




 110     }
 111 
 112     /**
 113      * Returns the last instruction in this list.
 114      *
 115      * @return the last instruction in this list, or <tt>null</tt> if the list
 116      *         is empty.
 117      */
 118     public AbstractInsnNode getLast() {
 119         return last;
 120     }
 121 
 122     /**
 123      * Returns the instruction whose index is given. This method builds a cache
 124      * of the instructions in this list to avoid scanning the whole list each
 125      * time it is called. Once the cache is built, this method run in constant
 126      * time. This cache is invalidated by all the methods that modify the list.
 127      *
 128      * @param index the index of the instruction that must be returned.
 129      * @return the instruction whose index is given.
 130      * @throws IndexOutOfBoundsException if (index {@literal <} 0 || index {@literal >=} size()).
 131      */
 132     public AbstractInsnNode get(final int index) {
 133         if (index < 0 || index >= size) {
 134             throw new IndexOutOfBoundsException();
 135         }
 136         if (cache == null) {
 137             cache = toArray();
 138         }
 139         return cache[index];
 140     }
 141 
 142     /**
 143      * Returns <tt>true</tt> if the given instruction belongs to this list.
 144      * This method always scans the instructions of this list until it finds the
 145      * given instruction or reaches the end of the list.
 146      *
 147      * @param insn an instruction.
 148      * @return <tt>true</tt> if the given instruction belongs to this list.
 149      */
 150     public boolean contains(final AbstractInsnNode insn) {