All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.java.trueupdate.util.Strings Maven / Gradle / Ivy

There is a newer version: 0.8.1
Show newest version
/*
 * Copyright (C) 2013 Schlichtherle IT Services & Stimulus Software.
 * All rights reserved. Use is subject to license terms.
 */
package net.java.trueupdate.util;

import javax.annotation.*;
import javax.annotation.concurrent.Immutable;

/**
 * Provides string functions.
 *
 * @author Christian Schlichtherle
 */
@Immutable
public final class Strings {

    public static String requireNonEmpty(final String string) {
        if (string.isEmpty()) throw new IllegalArgumentException();
        return string;
    }

    public static @Nullable String nonEmptyOr(@CheckForNull String string, @Nullable String defaultValue) {
        return null != string && !string.isEmpty() ? string : defaultValue;
    }

    private Strings() { }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy