Skip to content

Toro Cloud Dev Center


examples package: Using Stream in Gloop

The Stream class has been exposed so that you can still take advantage of the Java Streams API in Gloop. The services under the streams code directory of the examples package demonstrate how these functions are used.

Related articles

Please see the following articles for more information:

Try it!

In the Navigator, expand the examples package and navigate to the code folder, then expand the streams package. This package contains directories and services as shown below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
examples
├── ...
└── code
    ├── ...
    └── streams
        ├── helper
        │   └── ProvidePeople.gloop
        ├── model
        │   └── Person.gloop
        ├── CountUnique.gloop
        ├── FilterByStartingWith.gloop
        ├── FirstFiveOver18.gloop
        ├── GroupByAge.gloop
        ├── SortAlphabetically.gloop
        └── StreamChaining.gloop

Simply run the services directly under streams package to see the example services in action. For your benefit, these services are documented via comments.

Service Name Description
CountUnique.gloop Demonstrates the use of the distinct and count methods.
FilterByStartingWith.gloop Demonstrates how to filter an array of strings.
FirstFiveOver18.gloop Demonstrates the ability to use lazy loading.
GroupByAge.gloop Demonstrates how to group a map-like model.
SortAlphabetically.gloop Demonstrates how to sort an array.
StreamChaining.gloop Demonstrates how to chain Stream methods.