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:goja.initialize.ctxbox.ClassSearcher.java

/**
 * jarclass//from  w w  w  .j a v  a 2  s  .co m
 */
private List<String> findjarFiles(String baseDirName) {
    List<String> classFiles = Lists.newArrayList();
    File baseDir = new File(baseDirName);
    if (!baseDir.exists() || !baseDir.isDirectory()) {
        LOG.error("file search error:" + baseDirName + " is not a dir?");
    } else {
        File[] files = baseDir.listFiles();
        if (files == null) {
            return Collections.EMPTY_LIST;
        }
        for (File file : files) {
            if (file.isDirectory()) {
                classFiles.addAll(findjarFiles(file.getAbsolutePath()));
            } else {
                if (includeAllJarsInLib || includeJars.contains(file.getName())) {
                    JarFile localJarFile = null;
                    try {
                        localJarFile = new JarFile(new File(baseDirName + File.separator + file.getName()));
                        Enumeration<JarEntry> entries = localJarFile.entries();
                        while (entries.hasMoreElements()) {
                            JarEntry jarEntry = entries.nextElement();
                            String entryName = jarEntry.getName();
                            if (scanPackages.isEmpty()) {
                                if (!jarEntry.isDirectory() && entryName.endsWith(".class")) {
                                    String className = StringUtils.replace(entryName, StringPool.SLASH, ".")
                                            .substring(0, entryName.length() - 6);
                                    classFiles.add(className);
                                }
                            } else {
                                for (String scanPackage : scanPackages) {
                                    scanPackage = scanPackage.replaceAll("\\.", "\\" + File.separator);
                                    if (!jarEntry.isDirectory() && entryName.endsWith(".class")
                                            && entryName.startsWith(scanPackage)) {
                                        String className = StringUtils.replace(entryName, File.separator, ".")
                                                .substring(0, entryName.length() - 6);
                                        classFiles.add(className);
                                    }
                                }
                            }
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    } finally {
                        try {
                            if (localJarFile != null) {
                                localJarFile.close();
                            }
                        } catch (IOException e) {
                            LOG.error("close jar file has error!", e);
                        }
                    }
                }
            }

        }
    }
    return classFiles;
}

From source file:com.vmware.bdd.service.resmgmt.impl.VcInventorySyncService.java

private List<Future<List<AbstractSyncVcResSP>>> submit(ThreadPoolTaskExecutor es,
        List<AbstractSyncVcResSP> syncSps) {

    if (CollectionUtils.isNotEmpty(syncSps)) {
        List<Future<List<AbstractSyncVcResSP>>> newRefreshTaskList = new ArrayList();
        for (AbstractSyncVcResSP sp : syncSps) {
            counters.increasePendingRefresh();
            newRefreshTaskList.add(es.submit(sp));
        }/*from  w w w.  j  av a2  s . c o  m*/
        return newRefreshTaskList;
    } else {
        return Collections.EMPTY_LIST;
    }
}

From source file:com.impetus.ankush.admin.service.impl.GenericManagerImplTest.java

@Test
public void testGetByPropertyValueMapGuarded() {
    Map<String, Object> queryMap = Collections.singletonMap("property", (Object) "value");

    EasyMock.expect(genericDao.getAllByPropertyValue(queryMap, 0, Integer.MAX_VALUE))
            .andReturn(Collections.EMPTY_LIST);
    EasyMock.replay(genericDao);/*w ww.j  a v  a2  s  . c o  m*/

    assertNull("null not returned", genericManager.getByPropertyValueGuarded(queryMap));
}

From source file:knowledgeMiner.DisjointnessDisambiguator.java

public Collection<DefiniteAssertion> getRemovedAssertions() {
    if (caseNumber_ == -1)
        return Collections.EMPTY_LIST;
    return removedAssertions_;
}

From source file:com.blackducksoftware.integration.hub.teamcity.server.runner.HubParametersPreprocessor.java

private void handleLog(final String txt, final Throwable e) {
    log.message(HubConstantValues.PLUGIN_LOG + txt, Status.NORMAL, new Date(), "", "", Collections.EMPTY_LIST);
    if (e != null) {
        final StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        log.message(HubConstantValues.PLUGIN_LOG + sw.toString(), Status.NORMAL, new Date(), "", "",
                Collections.EMPTY_LIST);
    }/*from  w  w  w.  j a  v  a2  s.  c o  m*/
}

From source file:org.alfresco.jive.community.ws.AlfrescoServiceImpl.java

@Override
public EntityCollection<SpaceEntity> getSubSpaces(long id, int offset, int limit, String user) {
    SecurityContext sc = SecurityContextHolder.getContext();
    Authentication auth = sc.getAuthentication();

    try {/*from   w ww .  ja v a  2 s  .  c  o  m*/
        User jiveUser = userManager.getUser(encrypter.decrypt(user));
        sc.setAuthentication(new JiveUserAuthentication(jiveUser));

        Community parentSpace = communityManager.getCommunity(id);

        return EntityCollection.create(getSubSpaces(parentSpace, offset, limit));

    } catch (CannotDecryptException e) {
        throw OpenClientErrorBuilder.forbidden("Cannot decrypt user value");
    } catch (UserNotFoundException e) {
        throw OpenClientErrorBuilder.forbidden("No user specified or specified user does not exist");
    } catch (CommunityNotFoundException e) {
        throw OpenClientErrorBuilder.notFound(-1, "Community with id " + id + " not found");
    } catch (UnauthorizedException e) {
        OpenClientErrorBuilder.unauthorized();
    } finally {
        sc.setAuthentication(auth);
    }
    return EntityCollection.create(Collections.EMPTY_LIST);
}

From source file:com.linkedin.pinot.core.startree.BaseStarTreeIndexTest.java

/**
 * Helper method to compute the sum using aggregated docs.
 * @param metricNames/*from  w  w  w  .ja  v  a  2 s.  c  o  m*/
 * @param brokerRequest
 * @return
 */
Map<String, double[]> computeSumUsingAggregatedDocs(IndexSegment segment, List<String> metricNames,
        BrokerRequest brokerRequest) {
    StarTreeIndexOperator starTreeOperator = new StarTreeIndexOperator(segment, brokerRequest);
    starTreeOperator.open();
    BlockDocIdIterator starTreeDocIdIterator = starTreeOperator.nextBlock().getBlockDocIdSet().iterator();

    List<String> groupByColumns = Collections.EMPTY_LIST;
    if (brokerRequest.isSetAggregationsInfo() && brokerRequest.isSetGroupBy()) {
        groupByColumns = brokerRequest.getGroupBy().getColumns();
    }

    return computeSum(segment, starTreeDocIdIterator, metricNames, groupByColumns);
}

From source file:eu.domibus.common.dao.MessageLogDao.java

public List<String> getDownloadedUserMessagesOlderThan(Date date, String mpc) {
    final TypedQuery<String> query = em.createNamedQuery("MessageLogEntry.findDownloadedUserMessagesOlderThan",
            String.class);
    query.setParameter("DATE", date);
    query.setParameter("MPC", mpc);
    try {/*from w ww  .j  a v a 2  s.  co m*/
        return query.getResultList();
    } catch (NoResultException e) {
        return Collections.EMPTY_LIST;
    }
}

From source file:hr.fer.zemris.vhdllab.service.workspace.WorkspaceTest.java

@SuppressWarnings("unchecked")
@Test(expected = IllegalArgumentException.class)
public void addFile3() {
    Project project = new Project();
    File file = new File();
    file.setProject(project);//from  www .  jav  a2s.c  o m
    workspace.addFile(file, new Hierarchy(project, Collections.EMPTY_LIST));
}

From source file:org.openmrs.module.patientaccesscontrol.api.impl.PatientAccessControlServiceImpl.java

/**
 * @see PatientAccessControlService#getPatients(String, Integer, Integer)
 *///from www .  ja va  2 s . co  m
@SuppressWarnings("unchecked")
@Override
public List<Patient> getPatients(String query, Integer start, Integer length) throws APIException {
    List<Patient> patients = new Vector<Patient>();
    if (StringUtils.isBlank(query)) {
        return patients;
    }

    PatientAccess patientAccess = getPatientAccess();

    // if there is a number in the query string
    if (query.matches(".*\\d+.*")) {
        return dao.getPatients(null, query, Collections.EMPTY_LIST, false, start, length,
                patientAccess.getIncludedPatients(), patientAccess.getExcludedPatients());
    } else {
        return dao.getPatients(query, null, Collections.EMPTY_LIST, false, start, length,
                patientAccess.getIncludedPatients(), patientAccess.getExcludedPatients());
    }
}