Example usage for com.google.common.collect ObjectArrays concat

List of usage examples for com.google.common.collect ObjectArrays concat

Introduction

In this page you can find the example usage for com.google.common.collect ObjectArrays concat.

Prototype

public static <T> T[] concat(T[] array, @Nullable T element) 

Source Link

Document

Returns a new array that appends element to array .

Usage

From source file:com.facebook.presto.matching.Util.java

public static String indent(int indentLevel, String template, Object... args) {
    Object[] newArgs = ObjectArrays.concat(padding(indentLevel), args);
    return format("%s" + template, newArgs);
}

From source file:com.foundationdb.server.types.TStrongCasts.java

public static TStrongCastsBuilder from(TClass firstSource, TClass... sources) {
    return new TStrongCastsBuilder(ObjectArrays.concat(sources, firstSource));
}

From source file:org.comicwiki.model.Genre.java

public static Genre[] addGenre(Genre[] genres, Genre genre) {
    return ObjectArrays.concat(genres, genre);
}

From source file:cpw.mods.fml.client.registry.RenderingRegistry.java

/**
 * Add a new armour prefix to the RenderPlayer
 *
 * @param armor/*from   w ww. j  av a  2  s  . c om*/
 */
public static int addNewArmourRendererPrefix(String armor) {
    RenderBiped.bipedArmorFilenamePrefix = ObjectArrays.concat(RenderBiped.bipedArmorFilenamePrefix, armor);
    return RenderBiped.bipedArmorFilenamePrefix.length - 1;
}

From source file:org.craftercms.studio.impl.v1.web.http.MultiReadHttpServletRequestWrapper.java

public static void toMap(Iterable<NameValuePair> inputParams, Map<String, String[]> toMap) {
    for (NameValuePair e : inputParams) {
        String key = e.getName();
        String value = e.getValue();
        if (toMap.containsKey(key)) {
            String[] newValue = ObjectArrays.concat(toMap.get(key), value);
            toMap.remove(key);//from  www  .j a v a  2  s.  co m
            toMap.put(key, newValue);
        } else {
            toMap.put(key, new String[] { value });
        }
    }
}

From source file:com.github.shredder121.gh_event_api.GHEventApiServer.java

/**
 * The method to start multiple {@code app}s under the server.
 *
 * @param app multiple apps that will be included
 * @param args the optional (command-line) arguments
 * @return the running {@link ApplicationContext}
 *//*from ww w . ja v  a2s.c  om*/
public static ConfigurableApplicationContext start(Class<?>[] app, String... args) {
    Class<?>[] apps = ObjectArrays.concat(app, GHEventApiServer.class);
    return SpringApplication.run(apps, args);
}

From source file:org.richfaces.model.SequenceRowKey.java

public SequenceRowKey append(Object segment) {
    return new SequenceRowKey(ObjectArrays.concat(simpleKeys, segment));
}

From source file:org.shaf.server.controller.GenericActionController.java

/**
 * Returns the firewall.//  www.  j ava  2s.  com
 * 
 * @return the firewall.
 */
protected final Firewall getFirewall() {
    Role[] roles = new Role[0];
    for (Role role : Role.values()) {
        if (REQUEST.isUserInRole(role.getName())) {
            roles = ObjectArrays.concat(roles, role);
        }
    }
    return new Firewall(roles);
}

From source file:org.shaf.lib.io.func.ExtractFragFunction.java

/**
 * Returns the fragment of text, which is matching the specified pattern,
 * otherwise {@code null}./*w w w .  ja va 2 s  . c  om*/
 */
@Override
public String[] translate(String str) throws Exception {
    Matcher matcher = super.pattern.matcher(str);

    String[] fragments = new String[0];
    while (matcher.find()) {
        fragments = ObjectArrays.concat(fragments, str.substring(matcher.start(), matcher.end()));
    }

    if (fragments.length > 0) {
        return fragments;
    } else {
        return null;
    }
}

From source file:vogar.target.CaliperRunner.java

public boolean run(String actionName, Profiler profiler, String[] args) {
    monitor.outcomeStarted(this, testClass.getName(), actionName);
    String[] arguments = ObjectArrays.concat(testClass.getName(), args);
    if (profile) {
        arguments = ObjectArrays.concat("--debug", arguments);
    }/*from   ww w.j a  v a 2s  . co  m*/
    try {
        if (profiler != null) {
            profiler.start();
        }
        new Runner().run(arguments);
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        if (profiler != null) {
            profiler.stop();
        }
    }
    monitor.outcomeFinished(Result.SUCCESS);
    return true;
}