Example usage for java.util Collection stream

List of usage examples for java.util Collection stream

Introduction

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

Prototype

default Stream<E> stream() 

Source Link

Document

Returns a sequential Stream with this collection as its source.

Usage

From source file:org.homiefund.api.dto.UserDTO.java

public void setHomes(Collection<HomeDTO> homes) {
    authorities = new ArrayList<>(homes.stream().map(h -> new SimpleGrantedAuthority(h.getId().toString()))
            .collect(Collectors.toList()));
}

From source file:org.obiba.mica.web.model.LocalizedStringDtos.java

@NotNull
List<LocalizedString> fromDtoList(@NotNull Collection<Mica.LocalizedStringDtos> dtos) {
    return dtos.stream().map(dto -> fromDto(dto.getLocalizedStringsList())).collect(Collectors.toList());
}

From source file:de.metas.ui.web.view.event.JSONDocumentViewChangesEvent.java

private JSONDocumentViewChangesEvent(final Collection<DocumentViewChanges> changesList) {
    super();/*from   w  w w . j  a va2s.c  o  m*/
    changes = changesList.stream().map(changes -> JSONDocumentViewChanges.of(changes))
            .collect(GuavaCollectors.toImmutableList());
}

From source file:org.trustedanalytics.servicecatalog.service.rest.ServiceInstancesControllerHelpers.java

private Map<UUID, List<ServiceInstance>> createInstancesIndex(Collection<ServiceInstance> instances) {
    return instances.stream().collect(Collectors.groupingBy(i -> i.getServicePlan().getService().getGuid()));
}

From source file:org.obiba.mica.web.model.LocalizedStringDtos.java

@NotNull
List<Mica.LocalizedStringDtos> asDtoList(@NotNull Collection<LocalizedString> localizedStrings) {
    return localizedStrings.stream().map(localizedString -> Mica.LocalizedStringDtos.newBuilder()
            .addAllLocalizedStrings(asDto(localizedString)).build()).collect(Collectors.toList());
}

From source file:de.wpsverlinden.dupfind.DupeRemover.java

public void deleteAllDupes() {
    outputPrinter.print("Delete dupes ...");
    Collection<List<FileEntry>> dupeEntries = dupeFinder.getDupeEntries();
    dupeEntries.stream().forEach((lst) -> {
        while (lst.size() > 1) {
            String delPath = lst.get(lst.size() - 1).getPath();
            File del = new File(userDir + delPath);
            del.delete();//from   w w w . j  a  v  a2  s.  co  m
            fileIndex.remove(delPath);
            lst.remove(lst.size() - 1);
        }
    });
    outputPrinter.println(" done.");
}

From source file:de.metas.ui.web.dashboard.json.JSONDashboard.java

private JSONDashboard(final Collection<UserDashboardItem> items, final JSONOptions jsonOpts) {
    super();//from  ww w . j  a va2 s . c om

    this.items = items.stream().map(item -> JSONDashboardItem.of(item, jsonOpts))
            .collect(GuavaCollectors.toImmutableList());
}

From source file:de.wpsverlinden.dupfind.OutputPrinter.java

void printDupesOf(Collection<List<FileEntry>> dupeEntries) {
    dupeEntries.stream().filter((e) -> e.size() >= 2).forEach((lst) -> {
        println("-----");
        while (!lst.isEmpty()) {
            println(lst.get(0).toString());
            lst.remove(0);/*from w ww.  ja  va2 s.c  om*/
        }
        println("-----\n");
    });
}

From source file:com.fferreira.example.hazelcast.mapstore.HazelcastMapStore.java

@Override
public void deleteAll(final Collection<String> keys) {
    keys.stream().forEach((key) -> {
        delete(key);/*  ww  w. j  a va  2  s.  com*/
    });
}

From source file:com.spankingrpgs.scarletmoon.loader.ItemLoader.java

@Override
public void load(Collection<String> data, GameState state) {
    data.stream().forEach(datum -> loadItem(datum, state));
}