List<Block> (List<? extends ASTNode> nodes) { List<ChainedCallChunk> methodCall = splitMethodCallOnChunksByDots(nodes); Wrap wrap = null; Alignment chainedCallsAlignment = null; List<Block> blocks = new ArrayList<>(); for (int i = 0; i < methodCall.size(); i++) { ChainedCallChunk currentCallChunk = methodCall.get(i); if (isMethodCall(currentCallChunk) || isComment(currentCallChunk)) { if (wrap == null) { wrap = createCallChunkWrap(i, methodCall); } if (chainedCallsAlignment == null) { chainedCallsAlignment = createCallChunkAlignment(i, methodCall); } } else { wrap = null; chainedCallsAlignment = null; } LegacyCallChunkBlockBuilder builder = new LegacyCallChunkBlockBuilder(mySettings, myJavaSettings, myFormattingMode); blocks.add(builder.create(currentCallChunk.nodes, wrap, chainedCallsAlignment)); } return blocks; }