Example usage for java.util Collection toArray

List of usage examples for java.util Collection toArray

Introduction

In this page you can find the example usage for java.util Collection toArray.

Prototype

default <T> T[] toArray(IntFunction<T[]> generator) 

Source Link

Document

Returns an array containing all of the elements in this collection, using the provided generator function to allocate the returned array.

Usage

From source file:com.cyclopsgroup.waterview.servlet.MultipartServletRequestParameters.java

/**
 * Override or implement method of parent class or interface
 *
 * @see com.cyclopsgroup.waterview.Parameters#getFileItems(java.lang.String)
 *//*from ww w.j a  va 2  s  .  c o  m*/
public FileItem[] getFileItems(String name) {
    Collection items = (Collection) fileItems.get(name);
    return items == null ? EMPTY_FILEITEM_ARRAY : (FileItem[]) items.toArray(EMPTY_FILEITEM_ARRAY);
}

From source file:com.twosigma.beaker.core.module.elfinder.impl.AbstractCommand.java

protected Object[] files2JsonArray(HttpServletRequest request, Collection<FsItemEx> list) throws IOException {
    return files2JsonArray(request, list.toArray(new FsItemEx[list.size()]));
}

From source file:org.springmodules.validation.valang.functions.BeanPropertyFunction.java

private String[] pop(String[] path) {
    Collection coll = new ArrayList();
    for (int i = 1; i < path.length; i++) {
        coll.add(path[i]);//from  w w w. jav a2s .c  o  m
    }
    return (String[]) coll.toArray(new String[] {});
}

From source file:com.twosigma.beaker.core.module.elfinder.impl.DefaultFsService.java

public FsVolume[] getVolumes() {
    Collection<FsVolume> values = volumeMap.values();
    return values.toArray(new FsVolume[values.size()]);
}

From source file:com.autentia.showcase.web.rest.contacts.AddressBookController.java

@RequestMapping(value = "/contacts", method = RequestMethod.GET, params = "name")
@ResponseBody// ww w. j ava 2 s .c  o m
public Contact[] filterContactsBy(@RequestParam String name) {
    final Collection<Contact> contacts = addressBook.filterContactsBy(name);
    logger.debug("Retrieving {}/{} contacts", contacts.size(), contacts.size());
    return contacts.toArray(new Contact[contacts.size()]);
}

From source file:nl.surfnet.coin.ldap.LdapClientImpl.java

@Override
public List<Person> findPersons(Collection<String> identifiers) {
    Filter query = getFilter(identifiers.toArray(new String[identifiers.size()]));
    List<Person> search = findPersons(query);
    return search;
}

From source file:com.fferreira.example.hazelcast.mapstore.cassandra.HCCassandraWorkerTest.java

@Test(dependsOnGroups = CREATE_GROUP, groups = RUD_GROUP)
public void test_get_user_with_given_message() {
    final Collection<User> users = worker.getUsersByFirstName(user.getFirtName());
    assertEquals(users.size(), 1);//from  ww w .j a va2s  .  c o  m
    assertEquals(users.toArray(new User[users.size()])[0].getFirtName(), user.getFirtName());
}

From source file:com.cyberway.issue.crawler.extractor.ExtractorURI.java

/**
 * Perform usual extraction on a CrawlURI
 * /*from   w  w w  .  ja v a2 s  .  co m*/
 * @param curi Crawl URI to process.
 */
public void extract(CrawlURI curi) {

    this.numberOfCURIsHandled++;
    // use array copy because discoveriess will add to outlinks
    Collection<Link> links = curi.getOutLinks();
    Link[] sourceLinks = links.toArray(new Link[links.size()]);
    for (Link wref : sourceLinks) {
        extractLink(curi, wref);
    }
}

From source file:neembuu.uploader.zip.generator.NUCompiler.java

/**
 * Compile all the given files./*from  ww w .j  a  v a  2 s. com*/
 *
 * @param files All the files.
 */
private void compileFiles(Collection files) throws IOException {
    File[] resultFiles = (File[]) files.toArray(new File[files.size()]);
    File buildDir = CompilerUtils.getBuildDirectory(resultFiles[0]);
    compileFiles(resultFiles, buildDir);

    //Add to the classpath
    classPath += buildDir.getAbsolutePath() + ";";
}

From source file:com.cyclopsgroup.waterview.navigator.impl.DefaultNavigatorNode.java

/**
 * Overwrite or implement method in DefaultNavigatorNode
 *
 * @see com.cyclopsgroup.waterview.web.StaticNode#getChildrenNodes()
 */// www  .  jav a 2 s. c  om
public Node[] getChildrenNodes() {
    Collection nodes = navigatorHome.getChildren(path);
    return (Node[]) nodes.toArray(Node.EMPTY_ARRAY);
}