Example usage for java.lang String clone

List of usage examples for java.lang String clone

Introduction

In this page you can find the example usage for java.lang String clone.

Prototype

@HotSpotIntrinsicCandidate
protected native Object clone() throws CloneNotSupportedException;

Source Link

Document

Creates and returns a copy of this object.

Usage

From source file:fr.ribesg.bukkit.api.chat.Hover.java

/**
 * Builds a new Hover of type {@link Type#SHOW_TEXT}.
 *
 * @param lines the text/* w w  w. j av  a2s. c  om*/
 *
 * @return a new Hover of type SHOW_TEXT
 */
public static Hover of(final String... lines) {
    Validate.notEmpty(lines, "lines can't be empty");
    Validate.noNullElements(lines, "lines can't contain null elements");
    // TODO Support \n in Strings here if wanted
    return new Hover(Type.SHOW_TEXT, lines.clone());
}

From source file:org.jraf.irondad.protocol.Connection.java

public void send(Command command, String... params) throws IOException {
    String[] paramsCopy = params.clone();
    if (paramsCopy.length > 0) {
        // Add a colon to the last param if it contains spaces
        if (paramsCopy[paramsCopy.length - 1].contains(" ")) {
            paramsCopy[paramsCopy.length - 1] = ":" + paramsCopy[paramsCopy.length - 1];
        }/*w  ww  .  j  a  v a2  s . c o m*/
        send(command.name() + " " + StringUtils.join(paramsCopy, " "));
    } else {
        send(command.name());
    }
}

From source file:com.puppycrawl.tools.checkstyle.checks.imports.AvoidStaticImportCheck.java

/**
 * Sets the list of classes or static members to be exempt from the check.
 * @param excludes a list of fully-qualified class names/specific
 *     static members where static imports are ok
 *//*w  ww.j a va 2s .  c om*/
public void setExcludes(String... excludes) {
    this.excludes = excludes.clone();
}

From source file:Main.java

public ExtensionFileFilter(String description, String extensions[]) {
    if (description == null) {
        this.description = extensions[0];
    } else {/*from www.  jav  a2s  .  c  om*/
        this.description = description;
    }
    this.extensions = (String[]) extensions.clone();
    toLower(this.extensions);
}

From source file:net.xisberto.phonetodesktop.network.URLOptions.java

protected String[] unshorten(String... params) throws IOException {
    String[] result = params.clone();
    for (int i = 0; i < params.length; i++) {
        Utils.log("unshorten " + params[i]);

        URLConnection connection = new URL(params[i]).openConnection();
        connection.connect();//from  w w  w. j  ava 2 s .c  om
        InputStream instr = connection.getInputStream();
        instr.close();

        if (isCancelled) {
            return result;
        }

        result[i] = connection.getURL().toString();
        Utils.log("got " + result[i]);
    }
    return result;
}

From source file:net.xisberto.phonetodesktop.network.URLOptions.java

protected String[] getTitles(String... params) throws IOException, NullPointerException {
    String[] result = params.clone();
    for (int i = 0; i < params.length; i++) {
        Utils.log("getTitles " + params[i]);

        String title = getPageTitle(params[i]);
        if (title != null) {
            Utils.log("Found title " + title);
            result[i] = title;//from w w  w  . jav a 2s. c  om
        } else {
            result[i] = params[i];
        }

        if (isCancelled) {
            return result;
        }
    }
    return result;
}

From source file:ExtensionFileFilter.java

public ExtensionFileFilter(String description, String extensions[]) {
    if (description == null) {
        this.description = extensions[0] + "{ " + extensions.length + "} ";
    } else {//from   w  w  w  .  j  av a 2  s  .c o  m
        this.description = description;
    }
    this.extensions = (String[]) extensions.clone();
    toLower(this.extensions);
}

From source file:com.github.checkstyle.CliProcessor.java

/**
 * Constructs CliProcessor object.//from  w w  w.j a va2s  .c o  m
 * @param args command line cmdArgs.
 */
public CliProcessor(String... args) {
    cmdArgs = args.clone();
    errorMessages = new ArrayList<>();
}

From source file:com.siberhus.tdfl.transform.DefaultFieldSet.java

public DefaultFieldSet(String values[]) {
    this.values = values == null ? null : (String[]) values.clone();
}

From source file:edu.jhuapl.openessence.i18n.InspectableResourceBundleMessageSource.java

/**
 * Make the basenames in {@link ReloadableResourceBundleMessageSource} visible to this class.
 *///  ww w.  j a va 2 s  . c o m
public void setBasenames(String... basenames) {
    this.basenames = basenames.clone();
    super.setBasenames(basenames);
}