Example usage for java.util Objects requireNonNull

List of usage examples for java.util Objects requireNonNull

Introduction

In this page you can find the example usage for java.util Objects requireNonNull.

Prototype

public static <T> T requireNonNull(T obj) 

Source Link

Document

Checks that the specified object reference is not null .

Usage

From source file:at.gridtec.lambda4j.function.bi.BiShortFunction.java

/**
 * Lifts a partial {@link BiShortFunction} into a total {@link BiShortFunction} that returns an {@link Optional}
 * result.//from   ww w  .  j a  v  a  2 s  . c om
 *
 * @param <R> The type of return value from the function
 * @param partial A function that is only defined for some values in its domain
 * @return A partial {@code BiShortFunction} lifted into a total {@code BiShortFunction} that returns an {@code
 * Optional} result.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <R> BiShortFunction<Optional<R>> lift(@Nonnull final BiShortFunction<? extends R> partial) {
    Objects.requireNonNull(partial);
    return (value1, value2) -> Optional.ofNullable(partial.apply(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.BiDoubleFunction.java

/**
 * Lifts a partial {@link BiDoubleFunction} into a total {@link BiDoubleFunction} that returns an {@link Optional}
 * result.//from   w  w w  .ja v a 2 s.  c  om
 *
 * @param <R> The type of return value from the function
 * @param partial A function that is only defined for some values in its domain
 * @return A partial {@code BiDoubleFunction} lifted into a total {@code BiDoubleFunction} that returns an {@code
 * Optional} result.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <R> BiDoubleFunction<Optional<R>> lift(@Nonnull final BiDoubleFunction<? extends R> partial) {
    Objects.requireNonNull(partial);
    return (value1, value2) -> Optional.ofNullable(partial.apply(value1, value2));
}

From source file:at.gridtec.lambda4j.function.tri.TriBooleanFunction.java

/**
 * Lifts a partial {@link TriBooleanFunction} into a total {@link TriBooleanFunction} that returns an {@link
 * Optional} result.//from  w  ww .  ja v  a2  s  .c om
 *
 * @param <R> The type of return value from the function
 * @param partial A function that is only defined for some values in its domain
 * @return A partial {@code TriBooleanFunction} lifted into a total {@code TriBooleanFunction} that returns an
 * {@code Optional} result.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <R> TriBooleanFunction<Optional<R>> lift(@Nonnull final TriBooleanFunction<? extends R> partial) {
    Objects.requireNonNull(partial);
    return (value1, value2, value3) -> Optional.ofNullable(partial.apply(value1, value2, value3));
}

From source file:com.github.alexfalappa.nbspringboot.projects.initializr.InitializrProjectPanelVisual2.java

/**
 * Fixes the boot version of the dependencies.
 * <p>//from w  w w  .  ja  va  2  s. c o  m
 * Does nothing if the panel has not been initialized.
 *
 * @param bootVersion
 */
public void fixBootVersion(String bootVersion) {
    Objects.requireNonNull(bootVersion);
    if (initialized) {
        // substitute combo with label
        javax.swing.GroupLayout layout = (javax.swing.GroupLayout) this.getLayout();
        final JLabel label = new JLabel(bootVersion);
        label.setFont(label.getFont().deriveFont(Font.BOLD));
        layout.replace(cbBootVersion, label);
        // adapt dependencies panel
        pBootDependencies.adaptToBootVersion(bootVersion);
    }
}