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.orange.cloud.servicebroker.filter.core.service.mapper.SuffixedCatalogMapper.java

private ServiceDefinition toSuffixedServiceDefinition(ServiceDefinition serviceDefinition) {
    return new ServiceDefinition(withSuffix(serviceDefinition.getId(), serviceOfferingSuffix),
            withSuffix(serviceDefinition.getName(), serviceOfferingSuffix), serviceDefinition.getDescription(),
            serviceDefinition.isBindable(), serviceDefinition.isPlanUpdateable(),
            serviceDefinition.getPlans().stream().map(this::toPlan).collect(Collectors.toList()),
            serviceDefinition.getTags(), serviceDefinition.getMetadata(), serviceDefinition.getRequires(),
            serviceDefinition.getDashboardClient());
}

From source file:org.jimsey.projects.turbine.condenser.camel.splitters.StrategySplitter.java

public List<Message> split(@Headers Map<String, Object> headers, @Body TickJson tick) {
    logger.debug(" ---- in strategy splitter");
    Stock stock = marketsManager.findMarket(tick.getMarket()).findSymbol(tick.getSymbol());
    return stock.getStrategies().stream().map(strategy -> createMessage(strategy.run(tick), headers))
            .collect(Collectors.toList());
}

From source file:io.coala.json.JsonUtil.java

/**
 * @param instance//ww  w.j  a  v  a 2s  . c  om
 */
public synchronized static void initialize(final ObjectMapper om) {
    om.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);

    final Module[] modules = { new JodaModule(), new UUIDModule(), new JavaTimeModule() };
    om.registerModules(modules);
    LOG.trace("Using jackson v: {} with modules: {}", om.version(),
            Arrays.asList(modules).stream().map(m -> m.getModuleName()).collect(Collectors.toList()));
}

From source file:org.jimsey.projects.turbine.condenser.camel.splitters.IndicatorSplitter.java

public List<Message> split(@Headers Map<String, Object> headers, @Body TickJson tick) {
    logger.debug(" ---- in indicator splitter");
    Stock stock = marketsManager.findMarket(tick.getMarket()).findSymbol(tick.getSymbol());
    return stock.getIndicators().stream().map(indicator -> createMessage(indicator.run(tick), headers))
            .collect(Collectors.toList());
}

From source file:de.tudarmstadt.ukp.dkpro.core.testing.validation.CasValidator.java

public static CasValidator createWithAllChecks() {
    Reflections reflections = new Reflections(Check.class.getPackage().getName());
    CasValidator validator = new CasValidator();
    validator.setChecks(reflections.getSubTypesOf(Check.class).stream()
            .filter(c -> !Modifier.isAbstract(c.getModifiers())).collect(Collectors.toList()));
    return validator;
}

From source file:com.github.achatain.catalog.service.impl.CollectionServiceImpl.java

@Override
public List<CollectionDto> listCollections(final String userId) {
    return collectionDao.listCollections(userId).stream().map(colToLiteColDto).collect(Collectors.toList());
}

From source file:io.github.carlomicieli.footballdb.starter.parsers.TeamRosterParser.java

@Override
protected TeamRoster parseDocument(Document doc) {
    Stream<Element> rows = rosterTable(doc).flatMap(TeamRosterParser::rosterTableBody)
            .map(TeamRosterParser::rosterTableRows).orElseThrow(RuntimeException::new);

    List<TeamRoster.RosterEntry> players = rows.map(TeamRosterParser::rosterEntryValues)
            .map(TeamRoster.RosterEntry::of).collect(Collectors.toList());

    App.log().info("{} player(s) found.", players.size());

    return TeamRoster.builder().players(players).build();
}

From source file:alfio.controller.support.TicketDecorator.java

public static List<TicketDecorator> decorate(List<Ticket> tickets, boolean freeCancellationEnabled,
        Function<Ticket, Boolean> categoryEvaluator,
        Function<Ticket, List<Pair<TicketFieldConfigurationAndDescription, String>>> fieldsLoader) {
    return tickets.stream().map(t -> new TicketDecorator(t, freeCancellationEnabled, categoryEvaluator.apply(t),
            fieldsLoader.apply(t))).collect(Collectors.toList());
}

From source file:com.example.controller.user.UserRestaurantController.java

@RequestMapping(value = "/restaurants", method = RequestMethod.GET)
public Iterable<RestaurantDTO> list() {
    return Converter.convertRestaurant(lunchMenuRepository
            .findByUpdatedBetween(DataHelper.getYesterdayOrderTime(), DataHelper.getTodayOrderTime()).stream()
            .map(v -> v.getRestaurant()).collect(Collectors.toList()), true);
}

From source file:com.nebhale.buildmonitor.web.notify.MessagingProjectsChangedNotifier.java

@Override
public void projectsChanged() {
    List<Resource<Project>> resources = this.repository.findAll(new Sort("key")).stream()
            .map(this.resourceAssembler::toResource).collect(Collectors.toList());

    this.messageTemplate.convertAndSend("/app/projects", resources);
}