Example usage for org.apache.commons.collections ListUtils EMPTY_LIST

List of usage examples for org.apache.commons.collections ListUtils EMPTY_LIST

Introduction

In this page you can find the example usage for org.apache.commons.collections ListUtils EMPTY_LIST.

Prototype

List EMPTY_LIST

To view the source code for org.apache.commons.collections ListUtils EMPTY_LIST.

Click Source Link

Document

An empty unmodifiable list.

Usage

From source file:org.xwiki.query.internal.AbstractQueryFilter.java

/**
 * Get the list of columns present in the order by clause. This method is required because HSQLDB only
 * support SELECT DISTINCT SQL statements where the columns present in the order by clause are also present in the
 * select clause./*from  w ww .  ja v a 2  s .c  o  m*/
 *
 * @param statement the statement to evaluate.
 * @return the list of columns to return in the select clause as a string starting with ", " if there are columns or
 *         an empty string otherwise. The returned columns are extracted from the order by clause.
 */
protected List<String> getOrderByColumns(String statement) {
    List<String> columns = new ArrayList<String>();
    int oidx = statement.indexOf(ORDER_BY);

    if (oidx > -1) {
        String fragment = statement.substring(oidx + ORDER_BY.length());
        int gidx = fragment.indexOf(GROUP_BY);
        if (gidx > -1) {
            fragment = fragment.substring(0, gidx);
        }
        fragment = fragment.replaceAll(" desc", "");
        fragment = fragment.replaceAll(" asc", "");

        for (String column : fragment.split(COLUMN_SEPARATOR)) {
            columns.add(column.trim());
        }

        return columns;
    }

    return ListUtils.EMPTY_LIST;
}

From source file:org.xwiki.query.internal.CountDocumentFilterTest.java

@Test
public void getOrderByColumnsWithoutOrderBy() throws Exception {
    List<String> result = filter.getOrderByColumns("select doc.fullName from XWikiDocument doc");

    assertEquals(ListUtils.EMPTY_LIST, result);
}

From source file:pl.bcichecki.rms.model.impl.AddressDataEntity.java

@SuppressWarnings("unchecked")
public List<String> getContacts(ContactType contactType) {
    if (contacts == null) {
        return ListUtils.EMPTY_LIST;
    }//w  w w  . jav a 2s . com
    List<String> values = new ArrayList<String>();
    for (AddressDataContactEntity addressDataContact : contacts) {
        if (addressDataContact.getType().equals(contactType)) {
            values.add(addressDataContact.getValue());
        }
    }
    return values;
}