Collection toArray - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Collection toArray method.

This code example shows how to use the following methods:toArray
   * 
   * @param name    The field name 
   * @param values  The terms 
   */ 
    public TermsQueryBuilder(String name, Collection values) {
        this(name, values.toArray());
    } 
 
    /** 
     * Sets the minimum number of matches across the provided terms. Defaults to <tt>1</tt>. 
     */ 
    public TermsQueryBuilder minimumMatch(int minimumMatch) {
        this.minimumShouldMatch = Integer.toString(minimumMatch);
        return this;
    } 
 
    public TermsQueryBuilder minimumShouldMatch(String minimumShouldMatch) {
        this.minimumShouldMatch = minimumShouldMatch;
        return this;
    } 
7
CodeRank
This code example shows how to use the following methods:toArray
        return v;
    } 
 
    @Override 
    public Object[] toArray() {
        return queue.toArray();
    } 
 
    @Override 
    public <T> T[] toArray(T[] a) {
        return (T[]) queue.toArray(a);
    } 
 
    @Override 
    public boolean contains(Object o) {
        return queue.contains(o);
    } 
 
    @Override 
    public boolean containsAll(Collection<?> c) {
7
CodeRank
This code example shows how to use the following methods:size, toArray
This code example shows how to use the following methods:add, size, toArray
        // 
        // Note that in practise, this is only triggered when running in our tests 
 
        if (needJaxpImpl()) { 
            try { 
                classpath.add(ClasspathUtil.getClasspathForResource(ClassLoader.getSystemClassLoader(), "META-INF/services/javax.xml.parsers.SAXParserFactory").toURI().toURL());
            } catch (MalformedURLException e) {
                throw UncheckedException.throwAsUncheckedException(e);
            } 
        } 
 
        return new URLClassLoader(classpath.toArray(new URL[classpath.size()]), ClassLoader.getSystemClassLoader().getParent());
    } 
 
    public FilteringClassLoader createFilteringClassLoader(ClassLoader parent) {
        // See the comment for {@link #createIsolatedClassLoader} above 
        FilteringClassLoader classLoader = new FilteringClassLoader(parent);
        if (needJaxpImpl()) { 
            ServiceLocator locator = new ServiceLocator(ClassLoader.getSystemClassLoader());
            makeServiceVisible(locator, classLoader, SAXParserFactory.class);
7
CodeRank
This code example shows how to use the following methods:size, toArray
    public static OtpErlangList mkList(final OtpErlangObject... args) {
        return new OtpErlangList(args);
    } 
 
    public static OtpErlangList mkList(final Collection<OtpErlangObject> args) {
        return new OtpErlangList(args.toArray(new OtpErlangObject[args.size()]));
    } 
 
    public static OtpErlangTuple mkTuple(final OtpErlangObject... args) {
        return new OtpErlangTuple(args);
    } 
 
    public static OtpErlangList mkStringList(final Collection<?> args) {
        final List<OtpErlangObject> result = Lists.newArrayList();
        for (final Object s : args) {
            result.add(new OtpErlangString(s.toString()));
        } 
        return mkList(result);
    } 
 
7
CodeRank
This code example shows how to use the following methods:isEmpty, size, toArray
     * 
     * @param list 
     * @return 
     */ 
    public static <T> T getRandomElement(Queue<T> list) {
        if (list.isEmpty()) {
            return null; 
        } 
        return (T) list.toArray()[rng.nextInt(list.size())];
    } 
} 
7
CodeRank
This code example shows how to use the following methods:size, toArray
    return Collections.enumeration(parameters.keySet());
  } 
 
  public String[] getParameterValues(String s) {
    Collection<String> values = parameters.values();
    return values.toArray(new String[values.size()]);
  } 
 
  public Map getParameterMap() {
    return Collections.unmodifiableMap(parameters);
  } 
 
  public String getProtocol() {
    throw new UnsupportedOperationException();
  } 
 
  public String getScheme() {
    throw new UnsupportedOperationException();
  } 
 
7
CodeRank
This code example shows how to use the following methods:toArray
    } 
 
    /** 
     * Creates a text query with type "PHRASE_PREFIX" for the provided field name and text. 
     * 
     * @param name The field name. 
     * @param text The query text (to be analyzed). 
     * @deprecated use {@link #textPhrasePrefixQuery(String, Object)} instead 
     */ 
    public static MatchQueryBuilder textPhrasePrefix(String name, Object text) {
        return textPhrasePrefixQuery(name, text);
    } 
 
    /** 
     * Creates a text query with type "PHRASE_PREFIX" for the provided field name and text. 
     * 
     * @param name The field name. 
     * @param text The query text (to be analyzed). 
     * @deprecated Use {@link #matchPhrasePrefixQuery(String, Object)} 
     */ 
6
CodeRank
This code example shows how to use the following methods:isEmpty, size, toArray
     * referenced directly, but copied. 
     */ 
    public PolicyEntry(CodeSource cs, Collection<? extends Principal> prs,
            Collection<? extends Permission> permissions) {
        this.cs = (cs != null) ? normalizeCodeSource(cs) : null;
        this.principals = (prs == null || prs.isEmpty()) ? null
                : (Principal[]) prs.toArray(new Principal[prs.size()]);
        this.permissions = (permissions == null || permissions.isEmpty()) ? null
                : Collections.unmodifiableCollection(permissions);
    } 
 
    /** 
     * Checks if passed CodeSource matches this PolicyEntry. Null CodeSource of 
     * PolicyEntry implies any CodeSource; non-null CodeSource forwards to its 
     * imply() method. 
     */ 
    public boolean impliesCodeSource(CodeSource codeSource) {
        if (cs == null) {
            return true; 
        } 
6
CodeRank
This code example shows how to use the following methods:toArray
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public synchronized void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException {
        checkMinParameterCount(parameters, MIN_PARAM_COUNT);
        values = parameters.toArray();
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public String getReferenceKey() {
        return KEY;
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public List<String> getArgumentDesc() {
        return desc;
    } 
6
CodeRank
toArray Method Overview
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.
See Code Examples for other Java 8 Collection Methods: