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:fr.esiea.esieaddress.dao.implementation.DatabaseMock.java

public Collection<Contact> values(String collectionId) {
    if (database.containsKey(collectionId))
        return database.get(collectionId).values();
    return Collections.EMPTY_LIST;
}

From source file:at.gv.egiz.bku.binding.FormParameterImpl.java

@SuppressWarnings("unchecked")
@Override/*from   w  w  w. ja v a 2  s.  c  om*/
public Iterator<String> getHeaderNames() {
    if (headers == null) {
        return Collections.EMPTY_LIST.iterator();
    }
    return headers.getHeaderNames();
}

From source file:com.ethercamp.harmony.service.wallet.FileSystemWalletStore.java

public List<WalletAddressItem> fromStore() {
    final ObjectMapper mapper = new ObjectMapper();

    try {//w  w  w. j  a v a2  s  . c om
        final File file = getKeyStoreLocation().resolve(FILE_NAME).toFile();

        final String content = Files.readAllLines(file.toPath()).stream().collect(Collectors.joining(""));

        return mapper.readValue(content, new TypeReference<List<WalletAddressItem>>() {
        });
    } catch (NoSuchFileException e) {
        return Collections.EMPTY_LIST;
    } catch (IOException e) {
        throw new RuntimeException("Problem loading data. Message: " + e.getMessage(), e);
    }
}

From source file:jease.site.Fulltexts.java

/**
 * Returns all visible content which descends from given context and matches
 * the given query.//  w  ww .j  a  va2  s  .c  om
 */
public static List<Content> query(Content context, String query) {
    try {
        List<Content> result = new ArrayList<>();
        for (Content content : Database.query(fullTextIndex).search(query)) {
            // When content is child of a "paged container" (e.g.
            // Composite), traverse upwards to the top-level container.
            Content target = content;
            while (target.getParent() != null && ((Content) target.getParent()).isPage()
                    && target.getParent().isContainer()) {
                target = (Content) target.getParent();
            }
            if (!result.contains(target) && (context == null || target.isDescendant(context))) {
                result.add(target);
            }
        }
        return result;
    } catch (Exception e) {
        return Collections.EMPTY_LIST;
    }
}

From source file:org.ambraproject.action.BaseActionSupport.java

/**
 * This overrides the deprecated super implementation and returns an empty implementation as we
 * want to avoid JSON serializing the deprecated implementation when it tries to serialize
 * an Action when the result type is ajaxJSON.
 *
 * @return a empty list/*from  w ww. j av a  2s .co m*/
 */
@Override
public Collection getErrorMessages() {
    return Collections.EMPTY_LIST;
}

From source file:com.splicemachine.derby.stream.function.InnerJoinRestrictionFlatMapFunction.java

@Override
public Iterator<LocatedRow> call(Tuple2<LocatedRow, Iterable<LocatedRow>> tuple) throws Exception {
    checkInit();//from  w  w  w  . j ava2s .c  o m
    leftRow = tuple._1();
    Iterator<LocatedRow> it = tuple._2.iterator();
    while (it.hasNext()) {
        rightRow = it.next();
        mergedRow = JoinUtils.getMergedRow(leftRow.getRow(), rightRow.getRow(), op.wasRightOuterJoin,
                executionFactory.getValueRow(numberOfColumns));
        op.setCurrentRow(mergedRow);
        if (op.getRestriction().apply(mergedRow)) { // Has Row, abandon
            LocatedRow lr = new LocatedRow(rightRow.getRowLocation(), mergedRow);
            op.setCurrentLocatedRow(lr);
            return new SingletonIterator(lr);
        }
        operationContext.recordFilter();
    }
    return Collections.EMPTY_LIST.iterator();
}

From source file:de.wpsverlinden.dupfind.DupeFinderTest.java

@Test()
public void testGetDupesOfInvlidPath() {
    assertEquals(Collections.EMPTY_LIST, df.getDupesOf("invalid_path"));
}

From source file:gobblin.service.modules.topology.ConfigBasedTopologySpecFactory.java

@Override
public Collection<TopologySpec> getTopologies() {

    if (!_config.hasPath(ServiceConfigKeys.TOPOLOGY_FACTORY_TOPOLOGY_NAMES_KEY)) {
        return Collections.EMPTY_LIST;
    }/*from  ww w  . ja  v  a  2 s .  c  om*/
    Collection<TopologySpec> topologySpecs = Lists.newArrayList();
    Collection<String> topologyNames = SPLIT_BY_COMMA
            .splitToList(_config.getString(ServiceConfigKeys.TOPOLOGY_FACTORY_TOPOLOGY_NAMES_KEY));

    for (String topologyName : topologyNames) {
        Preconditions.checkArgument(_config.hasPath(ServiceConfigKeys.TOPOLOGY_FACTORY_PREFIX + topologyName),
                "Config does not contain Topology Factory descriptor for Topology" + topologyName);
        Config topologyConfig = _config.getConfig(ServiceConfigKeys.TOPOLOGY_FACTORY_PREFIX + topologyName);
        String description = ConfigUtils.getString(topologyConfig,
                ServiceConfigKeys.TOPOLOGYSPEC_DESCRIPTION_KEY, "NA");
        String version = ConfigUtils.getString(topologyConfig, ServiceConfigKeys.TOPOLOGYSPEC_VERSION_KEY,
                "-1");

        String specExecutorInstanceProducerClass = ServiceConfigKeys.DEFAULT_SPEC_EXECUTOR_INSTANCE_PRODUCER;
        if (topologyConfig.hasPath(ServiceConfigKeys.SPEC_EXECUTOR_INSTANCE_PRODUCER_KEY)) {
            specExecutorInstanceProducerClass = topologyConfig
                    .getString(ServiceConfigKeys.SPEC_EXECUTOR_INSTANCE_PRODUCER_KEY);
        }
        SpecExecutorInstanceProducer specExecutorInstanceProducer;
        try {
            _log.info(
                    "Using SpecExecutorInstanceProducer class name/alias " + specExecutorInstanceProducerClass);
            specExecutorInstanceProducer = (SpecExecutorInstanceProducer) ConstructorUtils.invokeConstructor(
                    Class.forName(_aliasResolver.resolve(specExecutorInstanceProducerClass)), topologyConfig);
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException
                | InstantiationException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }

        TopologySpec.Builder topologySpecBuilder = TopologySpec
                .builder(topologyConfig.getString(ServiceConfigKeys.TOPOLOGYSPEC_URI_KEY))
                .withConfig(topologyConfig).withDescription(description).withVersion(version)
                .withSpecExecutorInstanceProducer(specExecutorInstanceProducer);
        topologySpecs.add(topologySpecBuilder.build());
    }

    return topologySpecs;
}

From source file:edu.dfci.cccb.mev.stats.domain.cli.CliRWilcoxonBuilder.java

@SuppressWarnings("unchecked")
private List<Double> column(final String column) {
    return column != null ? new AbstractList<Double>() {

        @Override//  w w w.  j  a va 2 s .c  o  m
        @SneakyThrows(DatasetException.class)
        public Double get(int index) {
            return dataset().values().get(dataset().dimension(Type.ROW).keys().get(index), column);
        }

        @Override
        @SneakyThrows(InvalidDimensionTypeException.class)
        public int size() {
            return dataset().dimension(Type.ROW).keys().size();
        }
    } : ((List<Double>) Collections.EMPTY_LIST);
}

From source file:net.jcreate.home.common.BaseDAO.java

public List queryList(String pQueryString) throws DataAccessException {
    List result = hibernateTemplate.find(pQueryString);
    return result == null ? Collections.EMPTY_LIST : result;
}