// Path: src/main/java/org/fest/util/Preconditions.java
// public static @NotNull <T> T checkNotNull(@Nullable T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }


import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static org.fest.util.Preconditions.checkNotNull;
/*
 * Created on Jun 2, 2006
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 * 
 * Copyright @2006-2013 the original author or authors.
 */
package org.fest.util;



/**
 * Utility methods related to {@code String}s.
 *
 * @author Alex Ruiz
 */
public final class Strings {
  private Strings() {
  }

  /**
   * Indicates whether the given {@code String} is {@code null} or empty.
   *
   * @param s the {@code String} to check.
   * @return {@code true} if the given {@code String} is {@code null} or empty, otherwise {@code false}.
   */
  public static boolean isNullOrEmpty(@Nullable String s) {
    return s == null || s.length() == 0;
  }

  /**
   * Returns the given {@code String} surrounded by single quotes, or {@code null} if the given {@code String} is {@code
   * null}.
   *
   * @param s the given {@code String}.
   * @return the given {@code String} surrounded by single quotes, or {@code null} if the given {@code String} is {@code
   *         null}.
   */
  public static @Nullable String quote(@Nullable String s) {
    return s != null ? String.format("'%s'", s) : null;
  }

  /**
   * Returns the given object surrounded by single quotes, only if the object is a {@code String}.
   *
   * @param o the given object.
   * @return the given object surrounded by single quotes, only if the object is a {@code String}.
   * @see #quote(String)
   */
  public static @Nullable Object quote(@Nullable Object o) {
    return o instanceof String ? quote(o.toString()) : o;
  }

  /**
   * Concatenates the given objects into a single {@code String}. This method is more efficient than concatenating using
   * "+", since only one {@link StringBuilder} is created.
   *
   * @param objects the objects to concatenate.
   * @return a {@code String} containing the given objects, or empty {@code String} if the given array is empty.
   */
  public static @NotNull String concat(@NotNull Object... objects) {
// Path: src/main/java/org/fest/util/Preconditions.java
// public static @NotNull <T> T checkNotNull(@Nullable T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }


// Path: src/main/java/org/fest/util/Strings.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static org.fest.util.Preconditions.checkNotNull;

/*
 * Created on Jun 2, 2006
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 * 
 * Copyright @2006-2013 the original author or authors.
 */
package org.fest.util;



/**
 * Utility methods related to {@code String}s.
 *
 * @author Alex Ruiz
 */
public final class Strings {
  private Strings() {
  }

  /**
   * Indicates whether the given {@code String} is {@code null} or empty.
   *
   * @param s the {@code String} to check.
   * @return {@code true} if the given {@code String} is {@code null} or empty, otherwise {@code false}.
   */
  public static boolean isNullOrEmpty(@Nullable String s) {
    return s == null || s.length() == 0;
  }

  /**
   * Returns the given {@code String} surrounded by single quotes, or {@code null} if the given {@code String} is {@code
   * null}.
   *
   * @param s the given {@code String}.
   * @return the given {@code String} surrounded by single quotes, or {@code null} if the given {@code String} is {@code
   *         null}.
   */
  public static @Nullable String quote(@Nullable String s) {
    return s != null ? String.format("'%s'", s) : null;
  }

  /**
   * Returns the given object surrounded by single quotes, only if the object is a {@code String}.
   *
   * @param o the given object.
   * @return the given object surrounded by single quotes, only if the object is a {@code String}.
   * @see #quote(String)
   */
  public static @Nullable Object quote(@Nullable Object o) {
    return o instanceof String ? quote(o.toString()) : o;
  }

  /**
   * Concatenates the given objects into a single {@code String}. This method is more efficient than concatenating using
   * "+", since only one {@link StringBuilder} is created.
   *
   * @param objects the objects to concatenate.
   * @return a {@code String} containing the given objects, or empty {@code String} if the given array is empty.
   */
  public static @NotNull String concat(@NotNull Object... objects) {
    checkNotNull(objects);