Example usage for java.util Collections EMPTY_LIST

List of usage examples for java.util Collections EMPTY_LIST

Introduction

In this page you can find the example usage for java.util Collections EMPTY_LIST.

Prototype

List EMPTY_LIST

To view the source code for java.util Collections EMPTY_LIST.

Click Source Link

Document

The empty list (immutable).

Usage

From source file:de.idos.updates.install.FtpFileInstaller.java

@Override
public List<FTPFile> findAllElementsToInstall(Version version) throws IOException {
    if (ftpClient == null) {
        return Collections.EMPTY_LIST;
    }// ww  w.  j a va  2 s .  co m
    ftpClient.changeWorkingDirectory(version.asString());
    FTPFile[] ftpFiles = ftpClient.listFiles();
    ftpClient.changeToParentDirectory();
    return Arrays.asList(ftpFiles);
}

From source file:cec.easyshop.facades.suggestion.DefaultSimpleSuggestionFacadeIntegrationTest.java

@Test
public void testReferencesForPurchasedInCategory() {
    final UserModel user = userService.getUserForUID("dejol");
    userService.setCurrentUser(user);/*from  w w w  . j  a  va2  s  . co  m*/
    List<ProductData> result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Collections.EMPTY_LIST, false, null);
    Assert.assertEquals(4, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras", Collections.EMPTY_LIST,
            false, NumberUtils.INTEGER_ONE);
    Assert.assertEquals(1, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Arrays.asList(ProductReferenceTypeEnum.SIMILAR), false, null);
    Assert.assertEquals(1, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), false, null);
    Assert.assertEquals(2, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), true, null);
    Assert.assertEquals(1, result.size());
    final ProductData product = result.get(0);
    Assert.assertEquals("adapterDC", product.getCode());
    Assert.assertEquals("adapter", product.getName());
}

From source file:com.webbfontaine.valuewebb.search.CompanyFinder.java

public List getResultList() {
    if (StringUtils.isEmpty(companyCriteria.getActiveFor())) {
        return Collections.EMPTY_LIST;
    }/*from   w w w  . j  a  va  2s  .  c o m*/

    if (resultList != null) {
        return resultList;
    }

    select();
    return resultList;
}

From source file:net.innig.macker.rule.RuleSet.java

private RuleSet() {
    super(null);
    rules = Collections.EMPTY_LIST;
    patterns = new HashMap();
}

From source file:br.edu.ifpb.bdnc.db4o.crud.dao.Dao.java

@Override
public synchronized List<T> findParam(Class<T> clazz, Map<String, Object> param) {
    ObjectContainer db = Db4oFactory.newInstance();
    try {//from w w  w  .j a v  a2 s  .  c o  m
        Query query = db.query();
        Constraint constraint = query.constrain(clazz);
        if (param != null) {
            for (Map.Entry<String, Object> entrySet : param.entrySet()) {
                constraint = query.descend(entrySet.getKey()).constrain(entrySet.getValue()).and(constraint);
            }
            return (List<T>) query.execute().stream().collect(Collectors.toList());
        }
    } finally {
        db.close();
    }
    return Collections.EMPTY_LIST;
}

From source file:com.redhat.rhn.frontend.action.channel.PackageNameOverviewAction.java

/** {@inheritDoc} */
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) {/*from w  w w  .j  a v  a 2  s  .com*/
    String pkgName = request.getParameter("package_name");
    String subscribedChannels = request.getParameter("search_subscribed_channels");
    String channelFilter = request.getParameter("channel_filter");
    String[] channelArches = request.getParameterValues("channel_arch");
    request.setAttribute(ListTagHelper.PARENT_URL, request.getRequestURI());

    RequestContext ctx = new RequestContext(request);
    User user = ctx.getCurrentUser();

    List dr = Collections.EMPTY_LIST;
    if (StringUtils.equals(subscribedChannels, "yes")) {
        dr = PackageManager.lookupPackageNameOverview(user.getOrg(), pkgName);
    } else if (!StringUtils.isEmpty(channelFilter) && StringUtils.equals(subscribedChannels, "no")
            && channelArches == null) {
        Long filterChannelId = null;
        try {
            filterChannelId = Long.parseLong(channelFilter);
            dr = PackageManager.lookupPackageNameOverviewInChannel(user.getOrg(), pkgName, filterChannelId);
        } catch (NumberFormatException e) {
            log.warn("Exception caught, unable to parse channel ID: " + channelFilter);
            dr = Collections.EMPTY_LIST;
        }
    } else if (channelArches != null && channelArches.length > 0) {
        dr = PackageManager.lookupPackageNameOverview(user.getOrg(), pkgName, channelArches);
    }

    request.setAttribute(RequestContext.PAGE_LIST, dr);

    return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
}

From source file:net.chrisrichardson.foodToGo.domain.hibernate.HibernateRestaurantRepositoryImplMockTest.java

public void setUp() {
    mockHibernateTemplate = new Mock(HibernateTemplate.class);
    hibernateTemplate = (HibernateTemplate) mockHibernateTemplate.proxy();

    repository = new HibernateRestaurantRepositoryImpl(hibernateTemplate);

    restaurant = new Restaurant("Test", "TestType", Collections.EMPTY_SET, Collections.EMPTY_SET,
            Collections.EMPTY_LIST);

}

From source file:edu.cornell.mannlib.vitro.webapp.search.solr.IndividualToSolrDocument.java

public IndividualToSolrDocument(ClassProhibitedFromSearch classesProhibitedFromSearch,
        IndividualProhibitedFromSearch individualProhibitedFromSearch) {

    this(classesProhibitedFromSearch, individualProhibitedFromSearch, Collections.EMPTY_LIST);
}

From source file:com.blogspot.chicchiricco.persistence.AbstractBaseBean.java

/**
 * @return fields to be excluded when computing equals() or hashcode()
 *//*from  w w w.  j  av a 2 s .  c o m*/
private String[] getExcludeFields() {
    Set<String> excludeFields = new HashSet<String>();

    PropertyDescriptor[] propertyDescriptors = BeanUtils.getPropertyDescriptors(getClass());
    for (int i = 0; i < propertyDescriptors.length; i++) {

        if (propertyDescriptors[i].getPropertyType().isInstance(Collections.EMPTY_SET)
                || propertyDescriptors[i].getPropertyType().isInstance(Collections.EMPTY_LIST)) {

            excludeFields.add(propertyDescriptors[i].getName());
        }
    }

    return excludeFields.toArray(new String[] {});
}

From source file:com.aw.core.dao.AWQueryExecuter.java

private <Rsl> List<Rsl> execute(RowHandler<Rsl> rowHandler) {
    List<Rsl> rsl;//from  ww w  .j  a v a  2 s. c o m
    if (cacheName != null) {
        CacheEHImpl cache = new CacheEHImpl();
        cache.setName(cacheName);
        String key = sql + ListUtils
                .concatenarSepPorComa(sqlParams == null ? Collections.EMPTY_LIST : Arrays.asList(sqlParams));
        if (!cache.exist(key)) {
            rsl = executeSQL(rowHandler);
            ;
            cache.store(key, rsl);
        } else {
            rsl = (List<Rsl>) cache.get(key);
        }
    } else {
        rsl = executeSQL(rowHandler);
    }
    return rsl;
}