private static <T> BinaryOperator<T> throwingMerger() {
        return (u,v) -> { throw new DuplicateKeyException(u); };
    }
Returns a {@code Collector} that returns a singleton, or throws an {@code IllegalArgumentException} if there are more than one item.

@return A collector returning an optional element
@param <T> Type of the input elements.
@throws IllegalArgumentException if there are more than one element
vespajlib/src/main/java/com/yahoo/stream/CustomCollectors.java