List of usage examples for java.util List stream
default Stream<E> stream()
From source file:com.seabee.snapdragon.service.CustomUserDetailsService.java
public static List<GrantedAuthority> getGrantedAuthorities(List<String> roles) { List<GrantedAuthority> authorities; authorities = new ArrayList<GrantedAuthority>(); roles.stream().forEach((role) -> { authorities.add(new SimpleGrantedAuthority(role)); });//w w w.j a va 2 s .c om return authorities; }
From source file:de.metas.ui.web.window.datatypes.json.JSONDocumentLayoutColumn.java
static List<JSONDocumentLayoutColumn> ofList(final List<DocumentLayoutColumnDescriptor> columns, final JSONOptions jsonOpts) { return columns.stream().map(column -> of(column, jsonOpts)).collect(GuavaCollectors.toImmutableList()); }
From source file:com.u2apple.tool.util.StaticMapFileUtils.java
private static void sortModels(VID vid) { List<Modal> models = vid.getModals(); //Sort model values. models.stream().forEach((model) -> { if (model.getValues() == null || model.getValues().isEmpty()) { System.out.println(model); }//from w w w.j a v a 2s .com sortValue(model.getValues()); }); //Sort models. Collections.sort(models, (o1, o2) -> o1.getValues().get(0).getValue().compareToIgnoreCase(o2.getValues().get(0).getValue())); //Merge models. fastMergeModels(models); //Reverse contained model. for (int i = 0; i < models.size(); i++) { for (int j = i + 1; j < models.size(); j++) { if (valueContains(models.get(j).getValues(), models.get(i).getValues())) { models.add(i, models.remove(j)); } } } }
From source file:de.javagl.jgltf.browser.MenuNodes.java
/** * Create the JMenus for the menu node structure that is contained in * the JSON data provided by the given input stream. * The caller is responsible for closing the given stream. * /*from w w w. ja v a2 s. c om*/ * @param inputStream The input stream. * @return The menus * @throws IOException If an IO error occurs */ static List<JMenu> createMenus(InputStream inputStream) throws IOException { List<? extends MenuNode> menuNodes = read(inputStream); List<JMenuItem> menuItems = createMenuItems(menuNodes); return menuItems.stream().filter(e -> JMenu.class.isInstance(e)).map(e -> JMenu.class.cast(e)) .collect(Collectors.toList()); }
From source file:de.metas.ui.web.window.datatypes.json.JSONDocumentLayoutElementGroup.java
static List<JSONDocumentLayoutElementGroup> ofList( final List<DocumentLayoutElementGroupDescriptor> elementGroups, final JSONOptions jsonOpts) { return elementGroups.stream().map(elementGroup -> of(elementGroup, jsonOpts)) .collect(GuavaCollectors.toImmutableList()); }
From source file:org.hawkular.apm.server.api.utils.zipkin.SpanHttpDeriverUtil.java
/** * Method returns only client or sever http errors. * * @param httpCodes list of http codes/*from w w w.j a v a 2 s . co m*/ * @return Http client and server errors */ public static List<HttpCode> getClientOrServerErrors(List<HttpCode> httpCodes) { return httpCodes.stream().filter(x -> x.isClientOrServerError()).collect(Collectors.toList()); }
From source file:de.metas.ui.web.window.datatypes.json.JSONDocumentLayoutElementLine.java
static List<JSONDocumentLayoutElementLine> ofList(final List<DocumentLayoutElementLineDescriptor> elementsLines, final JSONOptions jsonOpts) { return elementsLines.stream() .map(elementsLine -> ofDocumentLayoutElementLineDescriptor(elementsLine, jsonOpts)) .filter(jsonElementsLine -> jsonElementsLine.hasElements()) .collect(GuavaCollectors.toImmutableList()); }
From source file:demo.support.NavUtils.java
public static List<Point> decodePolyline(String polyline) { final List<LatLng> latLngs = PolylineEncoding.decode(polyline); return latLngs.stream().map(latLng -> new Point(latLng.lat, latLng.lng)).collect(Collectors.toList()); }
From source file:com.lithium.flow.matcher.StringMatchers.java
@Nonnull private static StringMatcher buildComposite(@Nonnull List<StringMatcher> matchers, boolean lower) { matchers = matchers.stream().filter(matcher -> !(matcher instanceof NoStringMatcher)).collect(toList()); if (matchers.size() == 0) { return new NoStringMatcher(); } else if (matchers.size() == 1) { StringMatcher matcher = matchers.iterator().next(); return lower ? new LowerStringMatcher(matcher) : matcher; } else {//from ww w .ja v a2 s . c om return new CompositeOrStringMatcher(matchers, lower); } }
From source file:BluemixUtils.java
private static void showPhotoCountInDirs(List<ClassifierUnit> all) { all.stream().map((ClassifierUnit s) -> s.getFolderWithImages()) .forEach((s) -> System.out.print(s + " " + new File(s).listFiles(filter).length + "\n")); }