lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.util.IteratorUtil Class Reference

A utility class for Iterator. More...

Static Public Member Functions

static< T, S > Stream< S > asFilteredStream (Iterator< T > iterator, Class< S > cls)
 Given an iterator of type T, turn it into a stream containing only the instances of the given class of type S.
static< T > Iterable< T > asIterable (Iterator< T > iterator)
 Function to get Iterable from Iterator.
static< T > Stream< T > asStream (Iterator< T > iterator)
 Turn an iterator into a sequential stream.
static< T > Stream< T > asStream (Iterator< T > iterator, boolean parallel)
 Turn an iterator into a sequential or parallel stream.

Detailed Description

A utility class for Iterator.

Author
Marten Lohstroh
Hokeun Kim

Member Function Documentation

◆ asFilteredStream()

static< T, S > Stream< S > org.lflang.util.IteratorUtil.asFilteredStream ( Iterator< T > iterator,
Class< S > cls )
static

Given an iterator of type T, turn it into a stream containing only the instances of the given class of type S.

Parameters
<T>The type of elements the iterator iterates over.
<S>The type of class to filter out instance of.
iteratorAn iterator of type T.
clsA given class of type S.
Returns
A filtered stream that only has in it instances of the given class.

◆ asIterable()

static< T > Iterable< T > org.lflang.util.IteratorUtil.asIterable ( Iterator< T > iterator)
static

Function to get Iterable from Iterator.

Parameters
iteratorThe iterator to get an iterable from.
Returns
An iterable.

◆ asStream() [1/2]

static< T > Stream< T > org.lflang.util.IteratorUtil.asStream ( Iterator< T > iterator)
static

Turn an iterator into a sequential stream.

Parameters
iteratorThe iterator to create a sequential stream for.
Returns
A stream.

◆ asStream() [2/2]

static< T > Stream< T > org.lflang.util.IteratorUtil.asStream ( Iterator< T > iterator,
boolean parallel )
static

Turn an iterator into a sequential or parallel stream.

Parameters
iteratorThe iterator to create a stream for.
parallelWhether or not the stream should be parallel.
Returns
A stream.

The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/util/IteratorUtil.java