Example usage for java.util.stream Collectors toList

List of usage examples for java.util.stream Collectors toList

Introduction

In this page you can find the example usage for java.util.stream Collectors toList.

Prototype

public static <T> Collector<T, ?, List<T>> toList() 

Source Link

Document

Returns a Collector that accumulates the input elements into a new List .

Usage

From source file:com.teradata.presto.yarn.test.slider.SliderStatus.java

public List<String> getLiveComponentsHost(String component) {
    return stream(getLiveComponents(component)).map(liveComponent -> liveComponent.path("host").asText())
            .collect(Collectors.toList());
}

From source file:com.github.horrorho.inflatabledonkey.cloud.clients.AssetTokenClient.java

public static List<Asset> assetsFromAssetsList(HttpClient httpClient, CloudKitty kitty, ProtectionZone zone,
        Collection<Assets> assetsList) throws IOException {

    List<String> fileList = assetsList.stream().map(Assets::nonEmptyFiles).flatMap(Collection::stream)
            .collect(Collectors.toList());
    return assets(httpClient, kitty, zone, fileList);

}

From source file:com.example.resources.user.UserResource.java

@GetMapping
List<User> getUsers() {
    return userRepository.findAll().stream().map(User::new).collect(Collectors.toList());
}

From source file:org.trustedanalytics.ingestion.kafka2hdfs.api.StatusRestController.java

@RequestMapping(value = "/stats", method = RequestMethod.GET)
@ResponseBody//from   ww  w.j  a v a 2s .  com
public List<TopicMessageStats> allStats() {
    return consumingTasks.stream().map(TopicMessageStats::fromConsumingTask).collect(Collectors.toList());
}

From source file:io.github.carlomicieli.footballdb.starter.pages.TableBuilder.java

private static List<String> merge(List<String> first, List<String> second) {
    if (first == null || first.size() == 0)
        return second;
    return IntStream.range(0, first.size()).mapToObj(id -> first.get(id) + "." + second.get(id))
            .collect(Collectors.toList());
}

From source file:org.obiba.mica.web.rest.user.UsersProfileResource.java

@GET
@Path("/application/{application}")
@RequiresRoles(Roles.MICA_DAO)/*  w  w w .  j  ava  2s  .co m*/
public List<Mica.UserProfileDto> getProfilesByApplication(@PathParam("application") String application,
        @QueryParam("group") String group) {
    return userProfileService.getProfilesByApplication(application, group).stream().map(dtos::asDto)
            .collect(Collectors.toList());
}

From source file:org.jboss.pnc.rest.provider.LicenseProvider.java

public List<LicenseRest> getAll(Integer pageIndex, Integer pageSize, String sortingRsql, String query) {
    RSQLPredicate filteringCriteria = RSQLPredicateProducer.fromRSQL(License.class, query);
    Pageable paging = RSQLPageLimitAndSortingProducer.fromRSQL(pageSize, pageIndex, sortingRsql);

    return nullableStreamOf(licenseRepository.findAll(filteringCriteria.get(), paging)).map(toRestModel())
            .collect(Collectors.toList());
}

From source file:fi.helsinki.opintoni.service.converter.portfolio.StudyAttainmentWhitelistConverter.java

public StudyAttainmentWhitelistDto toDto(StudyAttainmentWhitelist whitelist) {
    StudyAttainmentWhitelistDto whitelistDto = new StudyAttainmentWhitelistDto();
    if (whitelist != null) {
        whitelistDto.oodiStudyAttainmentIds = whitelist.whitelistEntries.stream().map(e -> e.studyAttainmentId)
                .collect(Collectors.toList());
    }/*from w  w  w . j a  v  a2 s .  co  m*/
    return whitelistDto;
}

From source file:org.lecture.resource.UserResource.java

/**
 * Reads all attributes from entity that should get serialized.
 *//*from  w  w  w  .  ja  v  a2 s  .  c o  m*/
public UserResource(User entity) {
    this.username = entity.getUsername();
    this.authorities = entity.getAuthorities().stream().map(GrantedAuthority::getAuthority)
            .collect(Collectors.toList());
}

From source file:com.civprod.writerstoolbox.NaturalLanguage.util.TextAndTokenHandling.RegexTokenFilter.java

public List<String> filter(List<String> tokens) {
    return tokens.parallelStream().filter(this).collect(Collectors.toList());
}