Skip to main content

Java Stream implementation for Python

Project description

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Python Stream

The power of Java stream now available in Python
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

About The Project

What is Stream?

Stream represents a sequence of objects from a source, which supports aggregate operations.

Following are the characteristics of a Stream:

  • Sequence of elements − A stream provides a set of elements of specific type in a sequential manner. A stream gets/computes elements on demand. It never stores the elements.

  • Source − Stream takes Collections, Arrays, or I/O resources as input source.

  • Aggregate operations − Stream supports aggregate operations like filter, map, limit, reduce, find, and so on.

  • Pipelining − Most of the stream operations return stream itself so that their result can be pipelined. These operations are called intermediate operations and their function is to take input, process them, and return output to the target. toList() and toSet() methods are terminals operation which is normally present at the end of the pipelining operation to mark the end of the stream.

  • Automatic iterations − Stream operations do the iterations internally over the source elements provided, in contrast to Collections where explicit iteration is required.

Built With

Getting Started

Follow this steps for install this tool in the right way.

Prerequisites

That's all you need to use Streams:

  • python3
sudo apt install python3
  • pip
sudo apt install python3-pip

Installation

  1. Install the module with pip
pip install java-stream
  1. Import the module in your project
from stream import Stream

Usage

Here some example of how to use Streams:

  • Generate a list of 100 random numbers
Stream.randint(1, 100).limit(100).toList()
  • Print the numbers from 1 to 100
Stream.integers().limit(100).forEach(print)
  • Generate a list made of zeros with a length of 10
Stream.constant(0).limit(10).toList()
  • Generate a list of squares of the number from 1 to 20
IntStream.integers().map(lambda x: x**2).limit(20).toList()
  • Generate a set of the first 100 odds number
IntStream.odds().limit(100).toSet()
  • Generate a list of all the primes number smaller than 1000
Stream.primes().takeWhile(lambda x: x < 1000).toList()

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GNU License. See LICENSE for more information.

Contact

Alessandro Mazzoli - @alessandro.py - developer.alessandro.mazzoli@gmail.com

Project Link: https://github.com/alemazzo/python-java-stream

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

java-stream-1.5.1.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

java_stream-1.5.1-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file java-stream-1.5.1.tar.gz.

File metadata

  • Download URL: java-stream-1.5.1.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5

File hashes

Hashes for java-stream-1.5.1.tar.gz
Algorithm Hash digest
SHA256 594667fc9f7b2746404301a7cc6ce5d8caf252d66b576176ae8ff79370ffb6d8
MD5 29a26aa0da86704060bf2d2fffae5374
BLAKE2b-256 740b49359f2a341b182da3a970a8fa3116c13dc4df5330555790d258bf86cc0e

See more details on using hashes here.

File details

Details for the file java_stream-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: java_stream-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5

File hashes

Hashes for java_stream-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 beebeadccca6006868b7f8d192bb53dd3256da0bbde66cb8a5485ebf69fc9d22
MD5 e9af13fb832a273f657db12ac9545467
BLAKE2b-256 6338941b14acbe51f1d11b82061e48053359e57387c2ac41994674dd7f30075c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page