List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:alfio.model.TicketFieldConfigurationDescriptionAndValue.java
public List<TicketFieldValue> getFields() { if (count == 1) { return Collections.singletonList(new TicketFieldValue(0, 1, value)); }//from ww w .j a va2 s .c om List<String> values = StringUtils.isBlank(value) ? Collections.emptyList() : Json.fromJson(value, new TypeReference<List<String>>() { }); return IntStream.range(0, count) .mapToObj(i -> new TicketFieldValue(i, i + 1, i < values.size() ? values.get(i) : "")) .collect(Collectors.toList()); }
From source file:no.dusken.aranea.service.BannerServiceImpl.java
public List<Banner> getBanners() { List<Banner> list = Collections.emptyList(); try {//w w w . j ava2 s . c o m list = genericDao.getByNamedQuery("banners_all", null); } catch (DataAccessException dae) { log.info("Unable to get Banners", dae); } return list; }
From source file:no.dusken.aranea.service.IssueServiceImpl.java
public List<Issue> getIssuesPublished(int year) { List<Issue> i = Collections.emptyList(); try {// w ww . ja v a2 s. c om Map<String, Object> map = new HashMap<String, Object>(); map.put("fromDate", new GregorianCalendar(year, 0, 1)); GregorianCalendar endOfYear = new GregorianCalendar(year, 11, 31); GregorianCalendar today = new GregorianCalendar(); if (endOfYear.after(today)) { map.put("toDate", today); } else { map.put("toDate", endOfYear); } i = genericDao.getByNamedQuery("issues_byyear_published", map); } catch (DataAccessException dae) { log.warn("Unable to get Issues", dae); } return i; }
From source file:uk.co.flax.biosolr.ontology.core.ols.graph.GraphTest.java
@Test public void getEdgesBySource_badSource() throws Exception { Graph graph = new Graph(null, Collections.emptyList()); Collection<Edge> edges = graph.getEdgesBySource("http://www.ebi.ac.uk/efo/EFO_0005580", true); assertNotNull(edges);//from w w w . ja v a2s . c o m assertEquals(0, edges.size()); }
From source file:org.elasticsearch.test.rest.yaml.ClientYamlTestExecutionContextTests.java
public void testHeadersSupportStashedValueReplacement() throws IOException { final AtomicReference<Map<String, String>> headersRef = new AtomicReference<>(); final ClientYamlTestExecutionContext context = new ClientYamlTestExecutionContext(null, randomBoolean()) { @Override// w w w . ja va 2 s . c o m ClientYamlTestResponse callApiInternal(String apiName, Map<String, String> params, HttpEntity entity, Map<String, String> headers) { headersRef.set(headers); return null; } }; final Map<String, String> headers = new HashMap<>(); headers.put("foo", "$bar"); headers.put("foo1", "baz ${c}"); context.stash().stashValue("bar", "foo2"); context.stash().stashValue("c", "bar1"); assertNull(headersRef.get()); context.callApi("test", Collections.emptyMap(), Collections.emptyList(), headers); assertNotNull(headersRef.get()); assertNotEquals(headers, headersRef.get()); assertEquals("foo2", headersRef.get().get("foo")); assertEquals("baz bar1", headersRef.get().get("foo1")); }
From source file:com.heliosdecompiler.helios.controller.PathController.java
public void reload() { tasks.submit(new BackgroundTask(Message.TASK_RELOADING_PATH.format(), true, () -> { List<OpenedFile> reloaded = new ArrayList<>(); List<File> reloadedFiles = new ArrayList<>(); List<String> path = configuration.getList(String.class, Settings.PATH_KEY, Collections.emptyList()); for (String filepath : path) { File file = new File(filepath); if (file.exists()) { reloaded.add(new OpenedFile(messageHandler, file)); reloadedFiles.add(file); }/*from w w w . jav a 2 s .co m*/ } lock.lock(); try { pathOpenedFiles = reloaded; pathFiles = reloadedFiles; } finally { lock.unlock(); } })); }
From source file:com.evanzeimet.queryinfo.jpa.field.QueryInfoJPAAttributePathBuilder.java
protected QueryInfoJPAAttributePathBuilder(QueryInfoEntityContextRegistry entityContextRegistry, Class<R> root) {/*from ww w . j av a 2s . c o m*/ this.entityContextRegistry = entityContextRegistry; this.root = root; this.attributes = Collections.emptyList(); }
From source file:org.apereo.openlrs.storage.inmemory.InMemoryStorage.java
@Override public List<OpenLRSEntity> saveAll(Collection<OpenLRSEntity> entities) { if (entities != null && !entities.isEmpty()) { for (OpenLRSEntity entity : entities) { save(entity);/*from ww w. ja v a 2 s.co m*/ } return new ArrayList<OpenLRSEntity>(entities); } return Collections.emptyList(); }
From source file:com.orange.cepheus.cep.EsperEventProcessorTest.java
@After public void resetEmptyConfiguration() throws ConfigurationException { Configuration emptyConfiguration = new Configuration(); emptyConfiguration.setEventTypeIns(Collections.emptyList()); emptyConfiguration.setEventTypeOuts(Collections.emptyList()); emptyConfiguration.setStatements(Collections.emptyList()); esperEventProcessor.setConfiguration(emptyConfiguration); }
From source file:com.asakusafw.runtime.stage.temporary.TemporaryStorage.java
/** * Resolves the raw path pattern into the concrete path list. * @param conf current configuration//ww w . j ava 2s . com * @param pathPattern path pattern which describes temporary storage * @return the resolved paths * @throws IOException if failed to resolve path pattern * @throws IllegalArgumentException if some parameters were {@code null} */ public static List<Path> list(Configuration conf, Path pathPattern) throws IOException { if (conf == null) { throw new IllegalArgumentException("conf must not be null"); //$NON-NLS-1$ } if (pathPattern == null) { throw new IllegalArgumentException("pathPattern must not be null"); //$NON-NLS-1$ } List<FileStatus> statusList = listStatus(conf, pathPattern); if (statusList.isEmpty()) { return Collections.emptyList(); } List<Path> results = new ArrayList<>(); for (FileStatus status : statusList) { results.add(status.getPath()); } return results; }