Example usage for java.util Collections addAll

List of usage examples for java.util Collections addAll

Introduction

In this page you can find the example usage for java.util Collections addAll.

Prototype

@SafeVarargs
public static <T> boolean addAll(Collection<? super T> c, T... elements) 

Source Link

Document

Adds all of the specified elements to the specified collection.

Usage

From source file:com.google.android.apps.muzei.api.internal.SourceState.java

public void setUserCommands(UserCommand... userCommands) {
    mUserCommands = new ArrayList<UserCommand>();
    if (userCommands != null) {
        Collections.addAll(mUserCommands, userCommands);
    }/*from   ww  w  .j  a v  a2 s . com*/
}

From source file:org.another.logserver.config.Configurator.java

/**
 * Initializes the component.//from  w  ww  .  jav  a  2 s.  c  om
 */
@PostConstruct
public void init() {
    LOGGER.debug("Defined endpoints: {}", (Object[]) endPoints);

    this.configuredEndPoints = new ConcurrentHashMap<>();

    HashSet<String> endPointsHashSet = new HashSet<>();
    Collections.addAll(endPointsHashSet, endPoints);

    if (endPointsHashSet.contains(EndPointDefinition.REST_ENDPOINT.getShortDefinition())) {
        configureRestEndPoint();
    }

    if (endPointsHashSet.contains(EndPointDefinition.TCP_ENDPOINT.getShortDefinition())) {
        configureTCPEndPoint();
    }

    LOGGER.debug("Finalizing Configure task");

}

From source file:com.silverpeas.gallery.constant.StreamingProvider.java

StreamingProvider(final String idExtractorPattern, final String... regexpDetectionParts) {
    if (StringUtil.isDefined(idExtractorPattern)) {
        isExtractorPattern = Pattern.compile(idExtractorPattern);
    } else {/*from   w ww .j av a 2  s . c  o m*/
        isExtractorPattern = null;
    }
    this.regexpDetectionParts = new ArrayList<String>();
    this.regexpDetectionParts.add(name());
    Collections.addAll(this.regexpDetectionParts, regexpDetectionParts);
}

From source file:com.neocotic.bloggaer.account.Role.java

/**
 * Creates a new {@link Role} based on the {@code role} provided.
 * //from  w  w w  .j  av  a2  s  . com
 * @param role
 *            the {@link PredefinedRole} to base the {@code Role} on
 */
public Role(PredefinedRole role) {
    Collections.addAll(capabilities, role.getCapabilities());
    name = role.name();
    removable = Boolean.FALSE;
    title = role.getTitle();
}

From source file:com.silverpeas.gallery.constant.MediaMimeType.java

MediaMimeType(String... otherExtensions) {
    mimeType = FileUtil.getMimeType("file." + this.name().toLowerCase());
    extensions = new ArrayList<String>();
    extensions.add(name().toLowerCase());
    Collections.addAll(extensions, otherExtensions);
}

From source file:com.aevi.simpleexample.SecureCommunicationsActivity.java

private void displayConsoleText(String... messages) {
    progressBarVisible(false);
    Collections.addAll(consoleLines, messages);
    adapter.notifyDataSetChanged();
}

From source file:com.metawiring.load.generators.LineExtractGenerator.java

private void loadLines(String filename) {

    InputStream stream = LineExtractGenerator.class.getClassLoader().getResourceAsStream(filename);
    if (stream == null) {
        throw new RuntimeException(filename + " was missing.");
    }//from   w w w.jav  a  2s .  co  m

    CharBuffer linesImage;
    try {
        InputStreamReader isr = new InputStreamReader(stream);
        linesImage = CharBuffer.allocate(1024 * 1024);
        isr.read(linesImage);
        isr.close();
    } catch (IOException e) {
        logger.error(e.getMessage());
        throw new RuntimeException(e);
    }
    linesImage.flip();
    Collections.addAll(lines, linesImage.toString().split("\n"));
}

From source file:info.magnolia.beanmerger.ProxyBasedBeanMerger.java

@Override
protected Object mergeBean(List sources) {
    Set<Class> types = new HashSet<Class>();
    Class<?> mostSpecificAssignableClass = sources.get(0).getClass();
    while (Enhancer.isEnhanced(mostSpecificAssignableClass)) {
        mostSpecificAssignableClass = mostSpecificAssignableClass.getSuperclass();
    }/*from  w w w .  j  a  va2  s .c om*/

    for (Object source : sources) {

        // Skip up the class hierarchy to avoid proxying cglib proxy classes
        Class clazz = source.getClass();
        while (Enhancer.isEnhanced(clazz)) {
            clazz = clazz.getSuperclass();
        }

        Collections.addAll(types, clazz.getInterfaces());

        if (mostSpecificAssignableClass.isAssignableFrom(clazz)) {
            mostSpecificAssignableClass = clazz;
        }
    }
    types.add(mostSpecificAssignableClass);
    try {
        return new CglibProxyFactory().createInvokerProxy(newInvoker(sources),
                types.toArray(new Class<?>[types.size()]));
    } catch (RuntimeException e) {
        log.error("Failed to create proxy for sources {} with types {}", sources, types);
        throw e;
    }
}

From source file:org.dspace.authenticate.AuthenticationServiceImpl.java

@Override
public void afterPropertiesSet() {
    this.methodStack = new LinkedList<>();
    AuthenticationMethod[] methodStack = (AuthenticationMethod[]) PluginManager
            .getPluginSequence("authentication", AuthenticationMethod.class);
    Collections.addAll(this.methodStack, methodStack);
}

From source file:com.nike.vault.client.auth.VaultCredentialsProviderChain.java

/**
 * Explicit constructor that takes an array of providers to use.
 *
 * @param credentialsProviders Array of providers
 *//*from   w w  w.ja v  a  2  s  .  c o  m*/
public VaultCredentialsProviderChain(final VaultCredentialsProvider... credentialsProviders) {
    if (credentialsProviders == null || credentialsProviders.length == 0) {
        throw new IllegalArgumentException("No credentials providers specified");
    }

    Collections.addAll(this.credentialsProviderList, credentialsProviders);
}