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:com.nextep.designer.vcs.services.impl.DependencyService.java

@SuppressWarnings("unchecked")
@Override//w  w w . j  a  v a2 s .  c o m
public boolean checkDeleteAllowed(IReferenceable ref) {
    // New compilation bug, cannot use Collections.emptyList() here
    return checkDeleteAllowed(ref, Collections.EMPTY_LIST);
}

From source file:org.thingsplode.synapse.endpoint.swagger.EndpointApiGenerator.java

protected synchronized void scan() {
    BeanConfig bcScanner = new SynapseBeanConfig();
    //todo: read more content from the META-INF/manifest and add it to the service/endpoint description
    bcScanner.setResourcePackage(//from  ww w  . j a  v a 2 s. c  om
            this.packages.size() > 0 ? this.packages.stream().reduce((base, elm) -> base + "," + elm).get()
                    : "."); //generate comma separated list
    bcScanner.setVersion(this.apiVersion);
    bcScanner.setHost(this.host);
    bcScanner.setBasePath("/");
    bcScanner.setScan(true);

    //ScannerFactory.getScanner();
    logger.debug("using scanner " + bcScanner);
    SwaggerSerializers.setPrettyPrint(bcScanner.getPrettyPrint());
    Set<Class<?>> classes = bcScanner.classes();
    if (classes != null) {
        SynapseReader reader = new SynapseReader(swaggerModel, new ReaderConfig() {
            @Override
            public boolean isScanAllResources() {
                return true;
            }

            @Override
            public Collection<String> getIgnoredRoutes() {
                return Collections.EMPTY_LIST;
            }
        });
        swaggerModel = reader.read(classes);
        if (bcScanner instanceof SwaggerConfig) {
            swaggerModel = ((SwaggerConfig) bcScanner).configure(swaggerModel);
        }
    }

    initialized = true;
}

From source file:com.esri.gpt.control.webharvest.client.ckan.CkanIterator.java

@Override
public Iterator<CkanPackage> iterator() {
    Bots bots = config.getMode() != BotsMode.never ? BotsUtils.readBots(config.getMode(), baseUrl) : null;
    try {/*from  w  ww. j a  v  a 2 s  .c  o m*/
        JSONObject response = readJsonData(bots,
                config.getSkipList() || q != null ? makePackageSearchUrl(q, null, config.getRows())
                        : makePackageListUrl());
        if (response.has("result") && response.optBoolean("success", false)) {
            if (response.get("result") instanceof JSONArray) {
                CkanPackageList ckanPackageList = CkanParser.makePackageList(response.getJSONArray("result"));
                return new PackageListIterator(bots, ckanPackageList);
            } else if (response.get("result") instanceof JSONObject) {
                JSONObject result = response.getJSONObject("result");
                if (result.has("results") && result.get("results") instanceof JSONArray) {
                    long count = result.getLong("count");
                    JSONArray pkgs = result.getJSONArray("results");
                    List<CkanPackage> pkgsArr = readPackages(pkgs);
                    return new PackageSearchIterator(bots, pkgsArr, count);
                }
            }
        }
        return Collections.EMPTY_LIST.iterator();
    } catch (Exception ex) {
        return Collections.EMPTY_LIST.iterator();
    }
}

From source file:de.hybris.platform.commerceservices.setup.impl.AbstractSystemSetupTest.java

@Test
public void testInitOptions() throws Exception {
    final TestSystemSetup testSystemSetup = new TestSystemSetup();
    assertEquals("Options not empty", Collections.EMPTY_LIST, testSystemSetup.getInitializationOptions());
}

From source file:io.seldon.api.state.ZkSubscriptionHandler.java

private Collection<ChildData> getChildren(String node, TreeCache cache) {
    HashSet<ChildData> toReturn = new HashSet<>();

    if (cache == null) {
        cache = findParentCache(node);//from www  .  j  a  va2 s . co  m
        if (cache == null)
            return Collections.EMPTY_LIST;
    }
    Map<String, ChildData> children = cache.getCurrentChildren(node);
    if (children == null)
        return toReturn;
    for (ChildData child : children.values())
        toReturn.addAll(getChildren(child.getPath(), cache));
    toReturn.addAll(children.values());
    return toReturn;

}

From source file:corner.orm.gae.impl.PaginatedJpaEntityServiceTest.java

@Test
public void test_paginate() {
    EntityManager entityManager = newMock(EntityManager.class);
    Query query = newMock(Query.class);
    Query query2 = newMock(Query.class);
    expect(entityManager//from ww w.ja  v  a  2s.co m
            .createQuery("select root.id from corner.orm.gae.impl.TestAEntity as root  where name=:1"))
                    .andReturn(query);
    expect(entityManager
            .createQuery("select count(root)  from corner.orm.gae.impl.TestAEntity as root  where name=:1"))
                    .andReturn(query2);
    expect(query.setParameter("1", "acai")).andReturn(query);
    expect(query2.setParameter("1", "acai")).andReturn(query2);
    expect(query.setFirstResult(0)).andReturn(query);
    expect(query.setMaxResults(10)).andReturn(query);
    List listValue = Collections.EMPTY_LIST;
    expect(query.getResultList()).andReturn(listValue);
    expect(query2.getSingleResult()).andReturn(new Integer(1234));

    JpaTemplate jpaTemplate = GaeModule.buildJpaTemplate(entityManager);
    replay();
    PaginatedJapEntityService pjes = new PaginatedJapEntityService(jpaTemplate, typeCoercer);
    PaginationOptions options = new PaginationOptions();
    PaginationList pl = pjes.paginate(TestAEntity.class, new String[] { "name=:1", "acai" }, null, options);
    assertFalse(((Iterator) pl.collectionObject()).hasNext());
    PaginationOptions optionsR = pl.options();
    assertEquals(1234, optionsR.getTotalRecord());
    verify();
}

From source file:gobblin.service.SimpleKafkaSpecExecutorInstanceConsumer.java

public SimpleKafkaSpecExecutorInstanceConsumer(Config config, Optional<Logger> log) {
    super(config, log);

    // Consumer/*w w  w . ja  v a  2 s  .  c o m*/
    _kafka08Consumer = new Kafka08ConsumerClient.Factory().create(config);
    List<KafkaTopic> kafkaTopics = _kafka08Consumer.getFilteredTopics(Collections.EMPTY_LIST,
            Lists.newArrayList(Pattern.compile(config.getString(SPEC_KAFKA_TOPICS_KEY))));
    _partitions = kafkaTopics.get(0).getPartitions();
    _lowWatermark = Lists.newArrayList(Collections.nCopies(_partitions.size(), 0L));
    _nextWatermark = Lists.newArrayList(Collections.nCopies(_partitions.size(), 0L));
    _highWatermark = Lists.newArrayList(Collections.nCopies(_partitions.size(), 0L));

    InputStream dummyInputStream = new ByteArrayInputStream(new byte[0]);
    _decoder = DecoderFactory.get().binaryDecoder(dummyInputStream, null);
    _reader = new SpecificDatumReader<AvroJobSpec>(AvroJobSpec.SCHEMA$);
    _versionWriter = new FixedSchemaVersionWriter();
}

From source file:form.house.NewHouseForm.java

public List<Signs> toSign() {
    if (null == signs || signs.size() == 0)
        return Collections.EMPTY_LIST;
    return signs.stream().map(sign -> new Signs(sign)).collect(Collectors.toList());
}

From source file:se.vgregion.urlservice.services.DefaultUrlServiceService.java

/**
 * {@inheritDoc}//from w w w  .j ava2 s.c  om
 */
@SuppressWarnings("unchecked")
@Transactional
@Override
public Bookmark shorten(URI url, String hash, Owner owner) {
    return shorten(url, hash, Collections.EMPTY_LIST, owner);
}

From source file:is.idega.idegaweb.egov.gumbo.bpm.violation.ViolationDataProviderMock.java

public List<Item> getLawyersUsers() {

    try {//from  w  w w .ja  v  a2  s  . c  o  m
        final GroupBusiness groupBusiness = getGroupBusiness();

        final List<Group> lawyersGroups = (List<Group>) groupBusiness
                .getGroupsByGroupName("fiskistofa_lawyers");

        final Group lawyersGroup = lawyersGroups.isEmpty() ? null : lawyersGroups.iterator().next();

        final List<User> lawyersUsers = lawyersGroup != null ? (List<User>) groupBusiness.getUsers(lawyersGroup)
                : Collections.EMPTY_LIST;

        final List<Item> lawyersUsersItems = new ArrayList<Item>(lawyersUsers.size());

        for (User user : lawyersUsers) {
            lawyersUsersItems.add(new Item(user.getPrimaryKey().toString(), user.getName()));
        }

        return lawyersUsersItems;

    } catch (IDOFinderException e) {
        // TODO: log
        return Collections.EMPTY_LIST;
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}