FileNameInfo (@NotNull List<? extends DiffContent> contents, @NotNull List<String> titles, @Nullable String windowTitle, int index) { if (contents.size() == 2) { Side side = Side.fromIndex(index); DiffContent content = side.select(contents); String title = side.select(titles); String prefix = side.select("before", "after"); String name = getFileName(content, title, windowTitle); return new FileNameInfo(prefix, name); } else if (contents.size() == 3) { ThreeSide side = ThreeSide.fromIndex(index); DiffContent content = side.select(contents); String title = side.select(titles); String prefix = side.select("left", "base", "right"); String name = getFileName(content, title, windowTitle); return new FileNameInfo(prefix, name); } else { throw new IllegalArgumentException(String.valueOf(contents.size())); } }