List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:com.gooddata.md.report.ReportDefinitionContentTest.java
@Test public void testSerializable() throws Exception { final ReportDefinitionContent def = new GridReportDefinitionContent( new Grid(Collections.emptyList(), Collections.emptyList(), Collections.emptyList())); final ReportDefinitionContent deserialized = SerializationUtils.roundtrip(def); assertThat(deserialized, jsonEquals(def)); }
From source file:com.crossover.trial.weather.domain.AirportRepositoryImpl.java
@Override @Transactional(readOnly = true)// w w w. j a v a 2 s . com public Iterable<Airport> findInRadius(IATA fromIata, double distanceInKm) { Assert.isTrue(fromIata != null, "fromIata is required"); Assert.isTrue(distanceInKm > 0, "distanceInKm must be positive"); Airport fromAirport = airportRepository.findOne(fromIata); if (fromAirport == null) return Collections.emptyList(); return manager.createQuery("select a from Airport a where iata != :fromIata", Airport.class) .setParameter("fromIata", fromIata).getResultList().parallelStream() .filter(toAirport -> fromAirport.calculateDistance(toAirport) <= distanceInKm) .collect(Collectors.toList()); }
From source file:io.pivotal.auth.samlwrapper.userannotation.CurrentUserHandlerMethodArgumentResolver.java
public Object resolveArgument(MethodParameter methodParameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { if (!supportsParameter(methodParameter)) { return WebArgumentResolver.UNRESOLVED; }// ww w .ja va 2 s . c o m Principal principal = webRequest.getUserPrincipal(); if (principal == null) { return new User("Unauthenticated", "", Collections.emptyList()); } Object user = ((Authentication) principal).getPrincipal(); if (user instanceof User) { // also prevents null return return user; } return WebArgumentResolver.UNRESOLVED; }
From source file:io.pivotal.strepsirrhini.chaosloris.web.EventResourceAssemblerTest.java
@Test public void toResource() { Application application = new Application(UUID.randomUUID()); application.setId(-1L);/*from w w w . jav a 2 s . c om*/ Schedule schedule = new Schedule("0 0 * * * *", "hourly"); schedule.setId(-2L); Chaos chaos = new Chaos(application, 0.2, schedule); chaos.setId(-3L); Event event = new Event(chaos, Instant.EPOCH, Collections.emptyList(), Integer.MIN_VALUE); event.setId(-4L); EventResourceAssembler.EventResource resource = this.resourceAssembler.toResource(event); assertThat(resource.getContent()).isSameAs(event); assertThat(resource.getLinks()).hasSize(2); assertThat(resource.getLink("chaos")).isNotNull(); }
From source file:gov.nih.nci.caintegrator.application.study.MatchScoreComparator.java
/** * Returns the keywords as a <code>List</code>. * @param keywordsString a string with keywords seperated by spaces. * @return the keywords.//from w w w .j ava 2 s. com */ public List<String> convertStringToList(String keywordsString) { if (keywordsString != null) { return Arrays.asList(StringUtils.split(keywordsString)); } else { return Collections.emptyList(); } }
From source file:org.avidj.zuul.rs.ZuulTest.java
@Test public void itShallCreateShallowWriteLockOnRoot() { final Zuul zuul = createZuul(); given().standaloneSetup(zuul).param("t", "w").param("s", "s").when().put("/s/1/").then() .statusCode(HttpStatus.CREATED.value()); given().standaloneSetup(zuul).when().get("/s/1/").then().statusCode(HttpStatus.OK.value()).and() .body("key", hasItem(Collections.emptyList())).and().body("session", hasItem("1")).and() .body("type", hasItem("WRITE")).and().body("scope", hasItem("SHALLOW")).and() .body("count", hasItem(1)); }
From source file:de.linsin.github.rest.service.RepositoryBrowser.java
/** * Browse repositories for a user/*from w ww . ja va2 s .c om*/ * * @param argUsername {@link String} username * @return {@link List} containing {@link Repository} instances, empty List if user exists, but has no repositories * @throws NullPointerException in case passed username is null * @throws HttpClientErrorException in case the user doesn't exist */ public List<Repository> browse(String argUsername) { RestTemplate template = initTemplate(); RepositoriesResponse resp = template.getForObject(REPOSITORIES_URL, RepositoriesResponse.class, argUsername); if (resp == null || resp.getRepositories() == null || resp.getRepositories().length == 0) { return Collections.emptyList(); } else { return Arrays.asList(resp.getRepositories()); } }
From source file:cz.muni.fi.mir.db.dao.impl.ProgramDAOImpl.java
@Override public List<Program> getAllPrograms() { List<Program> resultList = Collections.emptyList(); try {/* w ww . ja v a 2 s.c o m*/ resultList = entityManager.createQuery("SELECT p FROM program p", Program.class).getResultList(); } catch (NoResultException nre) { logger.debug(nre); } return resultList; }
From source file:com.synopsys.integration.executable.Executable.java
public static Executable create(final File workingDirectory, File executableFile) { return create(workingDirectory, executableFile.getAbsolutePath(), Collections.emptyList()); }
From source file:gov.ca.cwds.cals.service.dao.FacilityChildDao.java
/** Get Placement Information for children. */ public List<ChildPlacementInformation> retrieveChildPlacementInformationList(String[] clientIds) { if (ArrayUtils.isEmpty(clientIds)) { return Collections.emptyList(); }//from w w w .j av a 2s .c o m List<ChildPlacementInformation> childPlacementInformationList = prepareChildPlacementInformationQuery( clientIds).list(); if (LOG.isWarnEnabled() && childPlacementInformationList.size() > clientIds.length) { LOG.warn("One or more than one child {} in the home has more than one open placement", Arrays.toString(clientIds)); } return childPlacementInformationList; }