public static void consumeNonBlankString(final String str,
                                             final boolean trimString,
                                             final Consumer<String> consumer) {
        // GWT doesn't emulate String::isBlank
        if (!isBlankString(str) && consumer != null) {
            if (trimString) {
                consumer.accept(str.trim());
            } else {
                consumer.accept(str);
            }
        }
    }
If str is not null/empty/blank then pass it to consumer (if that is not null).
stroom-util-shared/src/main/java/stroom/util/shared/NullSafe.java