Example usage for java.util Deque toArray

List of usage examples for java.util Deque toArray

Introduction

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

Prototype

<T> T[] toArray(T[] a);

Source Link

Document

Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.

Usage

From source file:automenta.climatenet.ImportKML.java

public String[] getPath(Deque<String> p) {
    return p.toArray(new String[p.size()]);
}

From source file:org.nuxeo.ecm.core.storage.ExpressionEvaluator.java

/**
 * Adds to the set all the sub-phrases from the start of the phraseWords.
 *//*  w w  w . ja v a 2 s. c o  m*/
private static void addPhraseWords(Set<String> set, Deque<String> phraseWords) {
    String[] array = phraseWords.toArray(new String[0]);
    for (int len = 2; len <= array.length; len++) {
        String phrase = StringUtils.join(array, ' ', 0, len);
        set.add(phrase);
    }
}

From source file:org.xframium.page.data.provider.AbstractPageDataProvider.java

public PageData[] getRecords(String recordType) {
    if (recordType.contains(".")) {
        String[] fieldArray = recordType.split("\\.");

        Deque<PageData> dataList = recordMap.get(fieldArray[0]).getRecordList();

        String useType = getRecordType(fieldArray[0]);

        for (PageData p : dataList) {
            if (p.getName().equals(useType)) {
                String newName = recordType.substring(recordType.indexOf(".") + 1);

                if (newName.trim().isEmpty())
                    return new PageData[] { p };
                else
                    return (PageData[]) p.get(newName);
            }//from   w w w . j a  v a2 s  . c  om
        }
        return dataList.toArray(new PageData[0]);
    } else {
        if (recordMap.get(recordType) == null)
            return null;

        Deque<PageData> dataList = recordMap.get(recordType).getRecordList();
        if (dataList != null)
            return dataList.toArray(new PageData[0]);
        else
            return null;
    }
}