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:jp.co.tis.gsp.tools.dba.mojo.ExecuteDdlMojo.java

@Override
protected void executeMojoSpec() throws MojoExecutionException, MojoFailureException {
    DriverManagerUtil.registerDriver(driver);
    Dialect dialect = DialectFactory.getDialect(url);
    dialect.dropAll(user, password, adminUser, adminPassword, schema);
    dialect.createUser(user, password, adminUser, adminPassword);

    FilenameFilter sqlFileFilter = new FilenameFilter() {
        @Override//from   w w  w  .  j a v  a2s  . c  o  m
        public boolean accept(File dir, String name) {
            return name.endsWith(".sql");
        }
    };

    // ?.sql?
    List<File> files = new ArrayList<File>(Arrays.asList(ddlDirectory.listFiles(sqlFileFilter)));
    if (extraDdlDirectory != null && extraDdlDirectory.isDirectory()) {
        Collections.addAll(files, extraDdlDirectory.listFiles(sqlFileFilter));
    }

    // ?? ????
    Collections.sort(files, new Comparator<File>() {
        @Override
        public int compare(File f1, File f2) {
            return f1.getName().compareTo(f2.getName());
        }
    });
    try {
        executeBySqlFiles(files.toArray(new File[files.size()]));
    } catch (Exception e) {
        getLog().warn(e);
    }
}

From source file:net.longfalcon.web.AdminIndexController.java

@RequestMapping(value = "/admin/site-edit", method = RequestMethod.GET)
public String editSiteView(Model model, HttpSession httpSession) {
    Site site = config.getDefaultSite();
    model.addAttribute("title", "Site Edit");
    model.addAttribute("siteObject", site);

    List<String> themeNameList = new ArrayList<>();
    try {/* w  ww . ja  v  a2s .  c o  m*/
        String realPath = httpSession.getServletContext().getRealPath("/public-resources/themes");
        File themesDir = new File(realPath);
        String[] themeDirList = themesDir.list();
        Collections.addAll(themeNameList, themeDirList);
    } catch (Exception e) {
        _log.error(e, e);
    }

    Map<Integer, String> showPasswordedRelOptionsMap = new HashMap<>();
    showPasswordedRelOptionsMap.put(0, "Dont show passworded or potentially passworded");
    showPasswordedRelOptionsMap.put(1, "Dont show passworded");
    showPasswordedRelOptionsMap.put(2, "Show everything");

    Map<Integer, String> newGroupsScanMethodMap = new HashMap<>();
    newGroupsScanMethodMap.put(1, "Days");
    newGroupsScanMethodMap.put(0, "Posts");

    Map<Integer, String> registerStatusMap = new HashMap<>();
    registerStatusMap.put(SiteService.REGISTER_STATUS_OPEN, "Open");
    registerStatusMap.put(SiteService.REGISTER_STATUS_INVITE, "Invite");
    registerStatusMap.put(SiteService.REGISTER_STATUS_CLOSED, "Closed");

    model.addAttribute("yesNoMap", YES_NO_MAP);
    model.addAttribute("showPasswordedRelOptionsMap", showPasswordedRelOptionsMap);
    model.addAttribute("newGroupsScanMethodMap", newGroupsScanMethodMap);
    model.addAttribute("registerStatusMap", registerStatusMap);
    model.addAttribute("themeNameList", themeNameList);
    return "admin/site-edit";
}

From source file:org.eel.kitchen.jsonschema.keyword.KeywordValidator.java

/**
 * Constructor//from   ww w. j av  a 2s  .  c  o  m
 *
 * @param types the types validated by this keyword
 */
protected KeywordValidator(final String keyword, final NodeType... types) {
    this.keyword = keyword;
    Collections.addAll(instanceTypes, types);
}

From source file:de.tor.tribes.util.bb.SosListFormatter.java

@Override
public String[] getTemplateVariables() {
    List<String> vars = new LinkedList<>();
    Collections.addAll(vars, VARIABLES);
    Collections.addAll(vars, new SOSRequest().getBBVariables());
    return vars.toArray(new String[vars.size()]);
}

From source file:net.longfalcon.newsj.util.ArrayUtil.java

public static <T> List<T> asList(T[] array) {
    ArrayList<T> list = new ArrayList<T>();
    Collections.addAll(list, array);

    return list;//w  ww.jav a2  s .  co m
}

From source file:com.segment.analytics.internal.Utils.java

/** Creates a mutable HashSet instance containing the given elements in unspecified order */
public static <T> Set<T> newSet(T... values) {
    Set<T> set = new HashSet<>(values.length);
    Collections.addAll(set, values);
    return set;//from   ww w. java2s. c  o m
}

From source file:com.github.ljtfreitas.restify.http.spring.contract.metadata.reflection.SpringWebJavaTypeMetadata.java

public String[] paths() {
    ArrayList<String> paths = new ArrayList<>();

    Optional.ofNullable(parent).map(p -> p.paths()).ifPresent(array -> Collections.addAll(paths, array));

    mapping.flatMap(m -> m.path()).ifPresent(p -> paths.add(p));

    return paths.toArray(new String[0]);
}

From source file:org.xacml4j.opensaml.OpenSamlMetadataFactoryBean.java

public void setLocations(List<String> locations) throws XPathExpressionException, TransformerException,
        ParserConfigurationException, SAXException, IOException {
    this.metadata = Lists.newLinkedList();
    for (String resourceLocation : locations) {
        if (resourceLocation != null) {
            Collections.addAll(metadata, resourcePatternResolver.getResources(resourceLocation));
        }//from w  w  w.  j a v  a  2  s .  c  om
    }
}

From source file:com.qubole.quark.fatjdbc.QuarkDriver.java

@Override
protected Collection<ConnectionProperty> getConnectionProperties() {
    final List<ConnectionProperty> list = new ArrayList<ConnectionProperty>();
    Collections.addAll(list, BuiltInConnectionProperty.values());
    Collections.addAll(list, CalciteConnectionProperty.values());
    return list;//  w  w w .j  a va 2s  . co m
}

From source file:com.icfcc.cache.annotation.AnnotationCacheOperationSource.java

/**
 * Create a custom AnnotationCacheOperationSource.
 * @param annotationParsers the CacheAnnotationParser to use
 *//*from   w w w  .j  a v  a2 s. co  m*/
public AnnotationCacheOperationSource(CacheAnnotationParser... annotationParsers) {
    this.publicMethodsOnly = true;
    Assert.notEmpty(annotationParsers, "At least one CacheAnnotationParser needs to be specified");
    Set<CacheAnnotationParser> parsers = new LinkedHashSet<CacheAnnotationParser>(annotationParsers.length);
    Collections.addAll(parsers, annotationParsers);
    this.annotationParsers = parsers;
}