@Test public void testRemove_noSuchElement() { InsnList insnList = newInsnList(insn1, insn2); Executable remove = () -> insnList.remove(new InsnNode(0)); assertThrows(NoSuchElementException.class, remove); }
public void remove(final AbstractInsnNode insnNode) { --size; AbstractInsnNode nextInsn = insnNode.nextInsn; AbstractInsnNode previousInsn = insnNode.previousInsn; if (nextInsn == null) { if (previousInsn == null) { firstInsn = null; lastInsn = null; } else { previousInsn.nextInsn = null; lastInsn = previousInsn; } } else { if (previousInsn == null) { firstInsn = nextInsn; nextInsn.previousInsn = null; } else { previousInsn.nextInsn = nextInsn; nextInsn.previousInsn = previousInsn; } } cache = null; insnNode.index = -1; insnNode.previousInsn = null; insnNode.nextInsn = null; }
InsnList { public void remove(final AbstractInsnNode insnNode) { --size; AbstractInsnNode nextInsn = insnNode.nextInsn; AbstractInsnNode previousInsn = insnNode.previousInsn; if (nextInsn == null) { if (previousInsn == null) { firstInsn = null; lastInsn = null; } else { previousInsn.nextInsn = null; lastInsn = previousInsn; } } else { if (previousInsn == null) { firstInsn = nextInsn; nextInsn.previousInsn = null; } else { previousInsn.nextInsn = nextInsn; nextInsn.previousInsn = previousInsn; } } cache = null; insnNode.index = -1; insnNode.previousInsn = null; insnNode.nextInsn = null; } }
InsnList { public void remove(final AbstractInsnNode insnNode) { --size; AbstractInsnNode nextInsn = insnNode.nextInsn; AbstractInsnNode previousInsn = insnNode.previousInsn; if (nextInsn == null) { if (previousInsn == null) { firstInsn = null; lastInsn = null; } else { previousInsn.nextInsn = null; lastInsn = previousInsn; } } else { if (previousInsn == null) { firstInsn = nextInsn; nextInsn.previousInsn = null; } else { previousInsn.nextInsn = nextInsn; nextInsn.previousInsn = previousInsn; } } cache = null; insnNode.index = -1; insnNode.previousInsn = null; insnNode.nextInsn = null; }  }
InsnList { public void remove(final AbstractInsnNode insnNode) { --size; AbstractInsnNode nextInsn = insnNode.nextInsn; AbstractInsnNode previousInsn = insnNode.previousInsn; if (nextInsn == null) { if (previousInsn == null) { firstInsn = null; lastInsn = null; } else { previousInsn.nextInsn = null; lastInsn = previousInsn; } } else { if (previousInsn == null) { firstInsn = nextInsn; nextInsn.previousInsn = null; } else { previousInsn.nextInsn = nextInsn; nextInsn.previousInsn = previousInsn; } } cache = null; insnNode.index = -1; insnNode.previousInsn = null; insnNode.nextInsn = null; }  int size(); AbstractInsnNode getFirst(); AbstractInsnNode getLast(); AbstractInsnNode get(final int index); boolean contains(final AbstractInsnNode insnNode); int indexOf(final AbstractInsnNode insnNode); void accept(final MethodVisitor methodVisitor); ListIterator<AbstractInsnNode> iterator(); @SuppressWarnings("unchecked") ListIterator<AbstractInsnNode> iterator(final int index); AbstractInsnNode[] toArray(); void set(final AbstractInsnNode oldInsnNode, final AbstractInsnNode newInsnNode); void add(final AbstractInsnNode insnNode); void add(final InsnList insnList); void insert(final AbstractInsnNode insnNode); void insert(final InsnList insnList); void insert(final AbstractInsnNode previousInsn, final AbstractInsnNode insnNode); void insert(final AbstractInsnNode previousInsn, final InsnList insnList); void insertBefore(final AbstractInsnNode nextInsn, final AbstractInsnNode insnNode); void insertBefore(final AbstractInsnNode nextInsn, final InsnList insnList); void remove(final AbstractInsnNode insnNode); void clear(); void resetLabels(); }
InsnList { public void remove(final AbstractInsnNode insnNode) { --size; AbstractInsnNode nextInsn = insnNode.nextInsn; AbstractInsnNode previousInsn = insnNode.previousInsn; if (nextInsn == null) { if (previousInsn == null) { firstInsn = null; lastInsn = null; } else { previousInsn.nextInsn = null; lastInsn = previousInsn; } } else { if (previousInsn == null) { firstInsn = nextInsn; nextInsn.previousInsn = null; } else { previousInsn.nextInsn = nextInsn; nextInsn.previousInsn = previousInsn; } } cache = null; insnNode.index = -1; insnNode.previousInsn = null; insnNode.nextInsn = null; }  int size(); AbstractInsnNode getFirst(); AbstractInsnNode getLast(); AbstractInsnNode get(final int index); boolean contains(final AbstractInsnNode insnNode); int indexOf(final AbstractInsnNode insnNode); void accept(final MethodVisitor methodVisitor); ListIterator<AbstractInsnNode> iterator(); @SuppressWarnings("unchecked") ListIterator<AbstractInsnNode> iterator(final int index); AbstractInsnNode[] toArray(); void set(final AbstractInsnNode oldInsnNode, final AbstractInsnNode newInsnNode); void add(final AbstractInsnNode insnNode); void add(final InsnList insnList); void insert(final AbstractInsnNode insnNode); void insert(final InsnList insnList); void insert(final AbstractInsnNode previousInsn, final AbstractInsnNode insnNode); void insert(final AbstractInsnNode previousInsn, final InsnList insnList); void insertBefore(final AbstractInsnNode nextInsn, final AbstractInsnNode insnNode); void insertBefore(final AbstractInsnNode nextInsn, final InsnList insnList); void remove(final AbstractInsnNode insnNode); void clear(); void resetLabels();  }