List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.candidacy.DistrictSubdivisionForResidenceInformationFormProvider.java
@Override public Object provide(Object source, Object currentValue) { final ResidenceInformationForm residenceInformationForm = (ResidenceInformationForm) source; if (residenceInformationForm.getDistrictOfResidence() != null) { List<DistrictSubdivision> result = new ArrayList<DistrictSubdivision>( residenceInformationForm.getDistrictOfResidence().getDistrictSubdivisionsSet()); Collections.sort(result, new BeanComparator("name")); return result; }//from w w w . j a v a 2 s . co m return Collections.emptyList(); }
From source file:br.com.thiaguten.persistence.demo.jpa.UserDAOImpl.java
@Override public List<User> findByName(String name) { String jpql = "SELECT u FROM User u WHERE UPPER(u.name) LIKE :name"; Map<String, String> namedParams = Collections.singletonMap("name", "%" + name.toUpperCase() + "%"); // like IGNORECASE and matchmode ANYWHERE List<User> results = persistenceProvider.findByQueryAndNamedParams(getPersistenceClass(), jpql, namedParams);/*from w w w . j a va 2 s .c om*/ if (results.isEmpty()) { return Collections.emptyList(); } else { return Collections.unmodifiableList(results); } }
From source file:com.seyren.core.domain.User.java
@Override public Collection<? extends GrantedAuthority> getAuthorities() { Set<String> roles = this.getRoles(); if (roles == null) { return Collections.emptyList(); }/*from w ww. j a v a2s. c o m*/ Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>(); for (String role : roles) { authorities.add(new SimpleGrantedAuthority(role)); } return authorities; }
From source file:org.carewebframework.vista.api.JsonDomainFactory.java
/** * Fetch multiple instances of the domain class from the data store. *///from w ww . j a v a2 s . c o m @SuppressWarnings("unchecked") @Override public <T extends Object> List<T> fetchObjects(Class<T> clazz, String[] ids) { if (ids == null || ids.length == 0) { return Collections.emptyList(); } String json = VistAUtil.getBrokerSession().callRPC("RGSER FETCH", PREFIX + getAlias(clazz), ids); return (List<T>) JSONUtil.deserialize(json); }
From source file:com.bazaarvoice.jolt.shiftr.ShiftrWriter.java
public ShiftrWriter(String dotNotation) { if (dotNotation.contains("@") || dotNotation.contains("*") || dotNotation.contains("$")) { throw new SpecException("DotNotation (write key) can not contain '@', '*', or '$'."); }/*from ww w .j av a2s . c o m*/ List<PathElement> paths; Traversr trav; if (StringUtils.isNotBlank(dotNotation)) { String[] split = dotNotation.split("\\."); paths = ShiftrSpec.parse(split); trav = new ShiftrTraversr(dotNotation); } else { paths = Collections.emptyList(); trav = new ShiftrTraversr(""); } List<EvaluatablePathElement> evalPaths = new ArrayList<EvaluatablePathElement>(paths.size()); for (PathElement pe : paths) { if (!(pe instanceof EvaluatablePathElement)) { throw new SpecException("RHS key=" + pe.getRawKey() + " is not a valid RHS key."); } evalPaths.add((EvaluatablePathElement) pe); } this.elements = Collections.unmodifiableList(evalPaths); this.traversr = trav; }
From source file:org.ebayopensource.twin.TwinConnection.java
/** * Send an OPTIONS request to the server. * @param path the URL to query/*from w w w .j a v a 2 s.c o m*/ * @return The list of allowed HTTP methods, or an empty list if the Allow header is not present in the response. * @throws TwinException */ List<String> options(String path) throws TwinException { try { BasicHttpRequest request = new BasicHttpRequest("OPTIONS", url + path); HttpClient client = getClient(); HttpResponse response = client.execute(new HttpHost(url.getHost(), url.getPort()), request); Header hdr = response.getFirstHeader("Allow"); if (hdr == null || hdr.getValue().isEmpty()) return Collections.emptyList(); return Arrays.asList(hdr.getValue().split("\\s*,\\s*")); } catch (IOException e) { throw TwinError.UnknownError.create("IOException when accessing RC", e); } }
From source file:be.ordina.msdashboard.controllers.NodesControllerTest.java
@Test public void getAllNodes() { doReturn(Collections.emptyList()).when(redisService).getAllNodes(); Collection<Node> nodes = nodesController.getAllNodes(); assertThat(nodes).isEmpty();/*from w w w . j a va2 s . c o m*/ }
From source file:no.dusken.aranea.service.PageServiceImpl.java
public List<Person> getPhotographers(Page page) { List<Person> list = Collections.emptyList(); try {//from w w w .j a va2s. c om Map<String, Object> map = new HashMap<String, Object>(); map.put("page", page); list = genericDao.getByNamedQuery("photographers_bypage", map); } catch (DataAccessException dae) { log.info("Unable to get photographs", dae); } return list; }
From source file:com.frank.search.solr.core.convert.SolrJConverter.java
@Override public <S, R> List<R> read(SolrDocumentList source, Class<R> type) { if (source == null) { return Collections.emptyList(); }/*from w w w. j av a 2s.com*/ List<R> resultList = new ArrayList<R>(source.size()); for (Map<String, ?> item : source) { resultList.add(read(type, item)); } return resultList; }
From source file:no.dusken.aranea.service.TagServiceImpl.java
public List<Tag> getTags() { List<Tag> list = Collections.emptyList(); try {/*from w w w .j ava2 s.c o m*/ list = genericDao.getByNamedQuery("tag_tags", null); } catch (DataAccessException dae) { log.info("Unable to get Tags", dae); } return list; }