@Override public <T extends CtBlock<R>> T insertEnd(CtStatementList statements) { for (CtStatement s : statements.getStatements()) { insertEnd(s); } return (T) this; }
@Override public <T extends CtBlock<R>> T insertBegin(CtStatementList statements) { if (getParent() != null && getParent() instanceof CtConstructor && getStatements().size() > 0) { CtStatement first = getStatements().get(0); if (first instanceof CtInvocation && ((CtInvocation<?>) first).getExecutable().getSimpleName().startsWith("<init>")) { first.insertAfter(statements); return (T) this; } } if (this.statements == CtElementImpl.<CtStatement>emptyList()) { this.statements = new ArrayList<CtStatement>( statements.getStatements().size() + BLOCK_STATEMENTS_CONTAINER_DEFAULT_CAPACITY); } this.statements.addAll(0, statements.getStatements()); return (T) this; }