List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:no.dusken.aranea.service.PersonServiceImpl.java
public List<Person> getPersons() { List<Person> list = Collections.emptyList(); try {/*from www .j a va 2 s .c o m*/ list = genericDao.getByNamedQuery("person_persons", null); } catch (DataAccessException dae) { log.warn("Unable to get Person", dae); } return list; }
From source file:net.sf.jabref.logic.search.DatabaseSearcher.java
public List<BibEntry> getMatches() { LOGGER.debug("Search term: " + query); if (!query.isValid()) { LOGGER.warn("Search failed: illegal search expression"); return Collections.emptyList(); }//from w w w.j av a 2s. c o m List<BibEntry> matchEntries = database.getEntries().stream().filter(query::isMatch) .collect(Collectors.toList()); return BibDatabases.purgeEmptyEntries(matchEntries); }
From source file:org.terasoluna.tourreservation.domain.service.tourinfo.TourInfoServiceImpl.java
@Override public Page<TourInfo> searchTour(TourInfoSearchCriteria criteria, Pageable pageable) { long total = tourInfoRepository.countBySearchCriteria(criteria); List<TourInfo> content; if (0 < total) { content = tourInfoRepository.findPageBySearchCriteria(criteria, pageable); } else {/* w w w. ja va 2s . c om*/ content = Collections.emptyList(); } Page<TourInfo> page = new PageImpl<TourInfo>(content, pageable, total); return page; }
From source file:ch.ivyteam.ivy.maven.BaseEngineProjectMojoTest.java
protected final static Collection<File> findFiles(File dir, String fileExtension) { if (!dir.exists()) { return Collections.emptyList(); }//from ww w . j a va 2 s. c o m return FileUtils.listFiles(dir, new String[] { fileExtension }, true); }
From source file:gumga.framework.application.service.JasperReportService.java
/** * Gera o relatorio com os dados e parametros informados. Chamando este * metodo o programador pode exportar da forma como quiser a partir do * objeto <code>JasperPrint</code>. * // ww w .ja v a2 s. c o m * @param reportStream A input stream contendo o arquivo .jasper * @param data Os dados a serem populados no relatorio * @param params Os parametros do relatorio. Opcional * @return O relatorio populado mas nao renderizado * @throws JRException Quando houver erro no jasper * @throws IOException Quando houver erro no arquivo informado */ public JasperPrint generateReport(InputStream reportStream, List data, Map<String, Object> params) throws JRException, IOException { if (data == null) { data = Collections.emptyList(); } if (params == null) { params = new HashMap<>(); } JasperReport jasperReport = (JasperReport) JRLoader.loadObject(reportStream); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, new JRBeanCollectionDataSource(data)); return jasperPrint; }
From source file:org.jboss.seam.forge.shell.util.PluginUtil.java
public static List<PluginRef> findPlugin(String repoUrl, String searchString, PipeOut out) throws Exception { DefaultHttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(repoUrl); out.print("Connecting to remote repository ... "); HttpResponse httpResponse = client.execute(httpGet); switch (httpResponse.getStatusLine().getStatusCode()) { case 200://w ww . jav a 2 s .c o m out.println("found!"); break; case 404: out.println("failed! (plugin index not found: " + repoUrl + ")"); return Collections.emptyList(); default: out.println("failed! (server returned status code: " + httpResponse.getStatusLine().getStatusCode()); return Collections.emptyList(); } Pattern pattern = Pattern.compile(GeneralUtils.pathspecToRegEx("*" + searchString + "*")); List<PluginRef> pluginList = new ArrayList<PluginRef>(); Yaml yaml = new Yaml(); for (Object o : yaml.loadAll(httpResponse.getEntity().getContent())) { if (o == null) { continue; } Map map = (Map) o; String name = (String) map.get("name"); if (pattern.matcher(name).matches()) { pluginList.add(bindToPuginRef(map)); } } return pluginList; }
From source file:cz.muni.fi.mir.db.dao.impl.ElementDAOImpl.java
@Override public List<Element> getAllElements() { List<Element> resultList = Collections.emptyList(); try {/*from w w w .j a v a 2 s.c o m*/ resultList = entityManager.createQuery("SELECT e FROM element e", Element.class).getResultList(); } catch (NoResultException nre) { logger.debug(nre); } return resultList; }
From source file:com.yoavst.quickapps.URLEncodedUtils.java
/** * Returns a list of {@link NameValuePair NameValuePairs} as built from the * URI's query portion. For example, a URI of * http://example.org/path/to/file?a=1&b=2&c=3 would return a list of three * NameValuePairs, one for a=1, one for b=2, and one for c=3. * <p/>//from w w w.j a v a2s . com * This is typically useful while parsing an HTTP PUT. * * @param uri uri to parse * @param encoding encoding to use while parsing the query */ public static List<NameValuePair> parse(final URI uri, final String encoding) { List<NameValuePair> result = Collections.emptyList(); final String query = uri.getRawQuery(); if (query != null && query.length() > 0) { result = new ArrayList<>(); parse(result, new Scanner(query), encoding); } return result; }
From source file:Main.java
public static List<Element> elements(Element element) { if (element == null || !element.hasChildNodes()) { return Collections.emptyList(); }//from ww w .j av a 2s. c om List<Element> elements = new ArrayList<Element>(); for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() == Node.ELEMENT_NODE) { elements.add((Element) child); } } return elements; }
From source file:com.weibo.datasys.crawler.impl.strategy.rule.seed.UpdateLinkDBRule.java
@Override public List<SeedData> apply(Null in) { long s = System.currentTimeMillis(); logger.info("[UpdateLinkDBRule] - set state to 1. start."); SaveStrategy saveStrategy = task.getSaveStrategy(); String sql = "update " + saveStrategy.getLinkDB() + "." + saveStrategy.getLinkTable() + " set state=1 where state=0"; int updateCount = LinkDataDAO.getInstance().modifyBySQL(sql, saveStrategy.getLinkDS()); long e = System.currentTimeMillis(); logger.info("[UpdateLinkDBRule] - set state to 1. done. cost={} ms. count={}", (e - s), updateCount); return Collections.emptyList(); }