List of usage examples for java.lang Iterable spliterator
default Spliterator<T> spliterator()
From source file:com.wrmsr.wava.basic.BasicLoopInfo.java
public static Set<Name> findBasicLoops(Iterable<Basic> basics, BasicDominatorInfo di) { return StreamSupport.stream(basics.spliterator(), false) .filter(b -> di.getDominanceFrontier(b.getName()).contains(b.getName())).map(Basic::getName) .collect(toHashSet());// w w w . ja va 2 s . c om }
From source file:com.streamsets.pipeline.lib.parser.excel.WorkbookParser.java
private static <T> Stream<T> stream(Iterable<T> it) { return StreamSupport.stream(it.spliterator(), false); }
From source file:net.hamnaberg.json.Property.java
static ArrayNode toArrayNode(Iterable<Property> data) { return stream(data.spliterator(), false).map(Extended::asJson).collect(JsonNodeFactory.instance::arrayNode, ArrayNode::add, ArrayNode::addAll); }
From source file:com.wrmsr.wava.basic.BasicLoopInfo.java
public static SetMultimap<Name, Name> findBasicBackEdges(Iterable<Basic> basics, Set<Name> loops, BasicDominatorInfo di) {//from ww w . j a v a2 s . c o m return StreamSupport.stream(basics.spliterator(), false).flatMap(brk -> { Set<Name> bdf = di.getDominanceFrontiers().get(brk.getName()); return brk.getAllTargets().stream() .filter(loop -> loops.contains(loop) && bdf.contains(loop) && (loop.equals(brk.getName()) || di.getDominated(loop).contains(brk.getName()))) .map(loop -> ImmutablePair.of(loop, brk.getName())); }).collect(toHashMultimap()); }
From source file:it.qualityGate.QualityGateTest.java
private static List<String> extractPosttaskPluginLogs(String taskUuid, Iterable<String> ceLogs) { return StreamSupport.stream(ceLogs.spliterator(), false) .filter(s -> s.contains("POSTASKPLUGIN: finished()")).filter(s -> s.contains(taskUuid)) .collect(Collectors.toList()); }
From source file:net.hamnaberg.json.Item.java
public static Item create(Optional<URI> href, Iterable<Property> properties, List<Link> links) { ObjectNode node = JsonNodeFactory.instance.objectNode(); href.ifPresent(uri -> node.put("href", uri.toString())); if (!Iterables.isEmpty(properties)) { node.set("data", StreamSupport.stream(properties.spliterator(), false).map(Extended::asJson) .collect(JsonNodeFactory.instance::arrayNode, ArrayNode::add, ArrayNode::addAll)); }// w w w .ja v a2s. com if (!Iterables.isEmpty(links)) { node.set("links", StreamSupport.stream(links.spliterator(), false).map(Extended::asJson) .collect(JsonNodeFactory.instance::arrayNode, ArrayNode::add, ArrayNode::addAll)); } return new Item(node); }
From source file:net.hamnaberg.json.Query.java
public static Query create(Target target, String rel, Optional<String> prompt, Optional<String> name, Iterable<Property> data) { ObjectNode obj = JsonNodeFactory.instance.objectNode(); obj.put("href", target.toString()); if (target.isURITemplate()) { obj.put("encoding", "uri-template"); }/*from ww w. j a va2s .c o m*/ obj.put("rel", rel); prompt.ifPresent(value -> obj.put("prompt", value)); name.ifPresent(value -> obj.put("name", value)); if (!Iterables.isEmpty(data)) { obj.set("data", StreamSupport.stream(data.spliterator(), false).map(Extended::asJson) .collect(JsonNodeFactory.instance::arrayNode, ArrayNode::add, ArrayNode::addAll)); } return new Query(obj); }
From source file:com.github.steveash.guavate.Guavate.java
/** * Converts an iterable to a serial stream. * <p>/*from www.j a va2 s . c om*/ * This is harder than it should be, a method {@code Stream.of(Iterable)} * would have been appropriate, but cannot be added now. * @param <T> the type of element in the iterable * @param iterable the iterable to convert * @return a stream of the elements in the iterable */ public static <T> Stream<T> stream(Iterable<T> iterable) { return StreamSupport.stream(iterable.spliterator(), false); }
From source file:org.obiba.mica.web.model.GitCommitInfoDtos.java
@NotNull public List<Mica.GitCommitInfoDto> asDto(Iterable<CommitInfo> commitInfos) { return StreamSupport.stream(commitInfos.spliterator(), false).map(this::asDto).collect(Collectors.toList()); }
From source file:edu.pitt.dbmi.ccd.db.service.GroupService.java
public List<Group> findByIds(Iterable<Long> ids) { return StreamSupport.stream(ids.spliterator(), false).map(this::findById).collect(Collectors.toList()); }