List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:org.juiser.spring.security.authentication.ClaimsGrantedAuthoritiesResolver.java
@Override public Collection<? extends GrantedAuthority> apply(Claims claims) { Collection<String> authorityStrings = authorityStringsResolver.apply(claims); if (CollectionUtils.isEmpty(authorityStrings)) { return Collections.emptyList(); }/*www.j ava 2 s. co m*/ return AuthorityUtils.createAuthorityList(authorityStrings.toArray(new String[authorityStrings.size()])); }
From source file:io.cloudslang.lang.runtime.bindings.InputsBindingTest.java
@Test public void testEmptyBindInputs() throws Exception { List<Input> inputs = Collections.emptyList(); Map<String, Serializable> result = bindInputs(inputs); Assert.assertTrue(result.isEmpty()); }
From source file:com.rockagen.gnext.service.spring.QueryObjectGenericServImpl.java
@Override public List<?> query(final QueryObject queryObject) { if (queryObject == null) { return Collections.emptyList(); }// ww w.j a v a 2 s. com Boolean limit = false; if (queryObject.getSize() > 0) { limit = true; } if (!CommUtil.isBlank(queryObject.getSql())) { if (limit) { if (notEmpty(queryObject.getMap())) { return getGenericDao().query(queryObject.getSql(), queryObject.getIndex(), queryObject.getSize(), queryObject.getMap()); } else { return getGenericDao().query(queryObject.getSql(), queryObject.getIndex(), queryObject.getSize(), queryObject.getArgs()); } } else { if (notEmpty(queryObject.getMap())) { return getGenericDao().query(queryObject.getSql(), queryObject.getMap()); } else { return getGenericDao().query(queryObject.getSql(), queryObject.getArgs()); } } } else if (queryObject.getDetachedCriteria() != null) { if (limit) { return getHibernate4GenericDao().queryByCriteria(queryObject.getDetachedCriteria(), queryObject.getIndex(), queryObject.getSize()); } else { return getHibernate4GenericDao().queryByCriteria(queryObject.getDetachedCriteria()); } } else { // XXX return Collections.emptyList(); } }
From source file:cz.muni.fi.mir.db.dao.impl.UserDAOImpl.java
@Override public List<User> getAllUsers() { List<User> resultList = Collections.emptyList(); try {//from w ww .j a v a2 s. c o m resultList = entityManager.createQuery("SELECT u FROM users u", User.class).getResultList(); } catch (NoResultException nre) { logger.debug(nre); } return resultList; }
From source file:org.openlmis.fulfillment.web.util.ProofOfDeliveryDtoBuilder.java
/** * Create a new list of {@link ProofOfDeliveryDto} based on data * from {@link Shipment}.// w w w .ja v a 2 s . co m * * @param pods collection used to create {@link ProofOfDeliveryDto} list (can be {@code null}) * @return new list of {@link ProofOfDeliveryDto}. Empty list if passed argument is {@code null}. */ public List<ProofOfDeliveryDto> build(Collection<ProofOfDelivery> pods) { if (null == pods) { return Collections.emptyList(); } return pods.stream().map(this::export).collect(Collectors.toList()); }
From source file:com.github.leonardoxh.temporeal.app.utils.JsonUtils.java
/** * Este metodo tambem transforma qualquer json valido * em algum dos nossos models porem este retorna uma lista * @param json um json valido para transformarmos em objeto * @param clazz a classe que esperamos/* w w w . jav a2 s . co m*/ * @param <T> tipo da classe para retorno * @return uma lista com os nossos models (nunca null) */ public static <T extends Model> List<T> listFromJson(String json, Class<T> clazz) { try { return OBJECT_MAPPER.readValue(json, new TypeReference<List<T>>() { }); } catch (Exception e) { e.printStackTrace(); } return Collections.emptyList(); }
From source file:cz.muni.fi.mir.db.dao.impl.UserRoleDAOImpl.java
@Override public List<UserRole> getAllUserRoles() { List<UserRole> resultList = Collections.emptyList(); try {//from w w w.jav a2 s .c o m resultList = entityManager.createQuery("SELECT ur FROM userRole ur", UserRole.class).getResultList(); } catch (NoResultException nre) { logger.debug(nre); } return resultList; }
From source file:com.bstek.dorado.data.provider.PagingList.java
@SuppressWarnings("unchecked") public PagingList(DataProvider dataProvider, DataType dataType, Object parameter, int pageSize, int pageNo) throws Exception { super((List<E>) Collections.emptyList()); this.dataProvider = dataProvider; this.dataType = dataType; this.parameter = parameter; this.pageSize = pageSize; this.gotoPage(pageNo); }
From source file:spring.travel.site.controllers.NewsController.java
@RequestMapping(method = RequestMethod.GET) @ResponseBody/* w ww . ja va 2 s . c o m*/ public DeferredResult<ModelAndView> news(@RequestInfo Request requestInfo) { return withOptionalUser(requestInfo, (request, response) -> { newsService.news().whenComplete((newsItems, throwable) -> { Map<String, ?> map = NewsPage.from(request.getUser(), newsItems.orElse(Collections.emptyList())); response.setResult(new ModelAndView("news", map)); }); }); }
From source file:org.openlmis.fulfillment.service.referencedata.ProgramReferenceDataService.java
/** * Finds programs by their ids./*from w w w .j a v a 2 s .c om*/ * * @param ids ids to look for. * @return a page of programs */ public Collection<ProgramDto> findByIds(Collection<UUID> ids) { if (CollectionUtils.isEmpty(ids)) { return Collections.emptyList(); } return findAll("", RequestParameters.init().set("id", ids)); }