List of usage examples for java.util Collection toArray
default <T> T[] toArray(IntFunction<T[]> generator)
From source file:cc.arduino.packages.Uploader.java
protected boolean executeUploadCommand(Collection<String> command) throws Exception { return executeUploadCommand(command.toArray(new String[command.size()])); }
From source file:com.phoenixst.collections.ClosureChain.java
/** * Creates a new <code>ClosureChain</code>. *//*from w w w .j a v a 2s .com*/ public ClosureChain(Collection closures) { super(); Closure[] temp = new Closure[closures.size()]; closureArray = (Closure[]) closures.toArray(temp); if (containsNull(closureArray)) { throw new IllegalArgumentException("Collection argument has a null element."); } }
From source file:com.tera.common.configuration.properties.CPropertyLoader.java
/** * @param directory/*from w ww .j a v a 2 s . com*/ * @return * @throws IOException */ private Properties[] loadPropertiesFromDirectory(File directory) throws IOException { Collection<File> dirFiles = FileUtils.listFiles(directory, new String[] { "properties" }, true); return loadPropertiesFromFiles(dirFiles.toArray(new File[dirFiles.size()])); }
From source file:com.cyclopsgroup.waterview.servlet.MultipartServletRequestParameters.java
/** * Overwrite or implement method doGetValues() * @see com.cyclopsgroup.waterview.Attributes#doGetValues(java.lang.String) *//*from w w w . j a va 2 s . c o m*/ protected String[] doGetValues(String name) throws Exception { Collection values = (Collection) content.get(name); return values == null ? ArrayUtils.EMPTY_STRING_ARRAY : (String[]) values.toArray(ArrayUtils.EMPTY_STRING_ARRAY); }
From source file:net.javacrumbs.springws.test.util.MockMessageSenderInjector.java
@SuppressWarnings("unchecked") public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { Collection<WebServiceTemplate> templates = beanFactory.getBeansOfType(WebServiceTemplate.class).values(); if (templates.size() == 0) { throw new BeanCreationException("No WebServiceTemplate found in the servlet context."); }/*from w ww . java 2 s .c o m*/ Collection<AbstractMockWebServiceMessageSender> mockSenders = beanFactory .getBeansOfType(AbstractMockWebServiceMessageSender.class).values(); WebServiceMessageSender[] mockSenderArray = mockSenders .toArray(new WebServiceMessageSender[mockSenders.size()]); for (WebServiceTemplate template : templates) { template.setMessageSenders(mockSenderArray); } }
From source file:com.thoughtworks.go.config.elastic.ElasticProfile.java
public ElasticProfile(String id, String clusterProfileId, Collection<ConfigurationProperty> configProperties) { this(id, clusterProfileId, configProperties.toArray(new ConfigurationProperty[0])); }
From source file:com.microsoft.tfs.core.credentials.internal.PersistenceStoreCredentialsManager.java
/** * {@inheritDoc}//from w w w .ja v a2 s. co m */ @Override public CachedCredentials[] getCredentials() { final Collection<CachedCredentials> credentials = load().values(); return credentials.toArray(new CachedCredentials[credentials.size()]); }
From source file:com.cyberway.issue.crawler.extractor.ExtractorImpliedURI.java
/** * Perform usual extraction on a CrawlURI * // w w w . j a v a2s . c o 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) { String implied = extractImplied(wref.getDestination(), (String) getUncheckedAttribute(curi, ATTR_TRIGGER_REGEXP), (String) getUncheckedAttribute(curi, ATTR_BUILD_PATTERN)); if (implied != null) { try { curi.createAndAddLink(implied, Link.SPECULATIVE_MISC, Link.SPECULATIVE_HOP); numberOfLinksExtracted++; final boolean removeTriggerURI = ((Boolean) getUncheckedAttribute(curi, ATTR_REMOVE_TRIGGER_URIS)).booleanValue(); // remove trigger URI from the outlinks if configured so. if (removeTriggerURI) { if (curi.getOutLinks().remove(wref)) { LOGGER.log(Level.FINE, wref.getDestination() + " has been removed from " + wref.getSource() + " outlinks list."); numberOfLinksExtracted--; } else { LOGGER.log(Level.FINE, "Failed to remove " + wref.getDestination() + " from " + wref.getSource() + " outlinks list."); } } } catch (URIException e) { LOGGER.log(Level.FINE, "bad URI", e); } } } }
From source file:com.phoenixst.collections.AllPredicate.java
/** * Creates a new <code>AllPredicate</code>. *//*from ww w. j ava2 s. c o m*/ public AllPredicate(Collection predicates) { super(); Predicate[] temp = new Predicate[predicates.size()]; predicateArray = (Predicate[]) predicates.toArray(temp); if (containsNull(predicateArray)) { throw new IllegalArgumentException("Collection argument has a null element."); } }
From source file:com.phoenixst.collections.AnyPredicate.java
/** * Creates a new <code>AnyPredicate</code>. *//*from w ww .j a v a2 s . c o m*/ public AnyPredicate(Collection predicates) { super(); Predicate[] temp = new Predicate[predicates.size()]; predicateArray = (Predicate[]) predicates.toArray(temp); if (containsNull(predicateArray)) { throw new IllegalArgumentException("Collection argument has a null element."); } }