Element (@NotNull HtmlChunk @NotNull ... chunks) { if (myChildren.isEmpty()) { return new Element(myTagName, myAttributes, Arrays.asList(chunks)); } List<HtmlChunk> newChildren = new ArrayList<>(myChildren.size() + chunks.length); newChildren.addAll(myChildren); Collections.addAll(newChildren, chunks); return new Element(myTagName, myAttributes, newChildren); }