TextDomain (List<? extends TextContent> components) { TextDomain domain = components.get(0).getDomain(); if (components.stream().anyMatch(c -> c.getDomain() != domain)) { throw new IllegalArgumentException("Joined TextContents should share the same domain"); } return domain; }