All Projects → retrostreams → android-retrostreams

retrostreams / android-retrostreams

Licence: other
Backport of Java 9 java.util.stream API for Android Studio 3.x D8 / desugar toolchain, forked from https://github.com/stefan-zobel/streamsupport

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to android-retrostreams

java-handles-kata
Java Reflection and Unsafe Alternates - MethodHandle and VarHandle API - Fix broken tests in a Code Kata
Stars: ✭ 15 (-86.11%)
Mutual labels:  java9
modern-java-demos
Modern Java: From Java 8 to Java 18. 现代Java案例大全/《Java核心编程》源码
Stars: ✭ 98 (-9.26%)
Mutual labels:  java9
java-9-flow-reactive
A sample application using Java 9's Flow API and SubmissionPublisher
Stars: ✭ 32 (-70.37%)
Mutual labels:  java9
proxybuilder
www.proxybuilder.org
Stars: ✭ 19 (-82.41%)
Mutual labels:  java9
Lightweight Stream Api
Stream API from Java 8 rewritten on iterators for Java 7 and below
Stars: ✭ 1,582 (+1364.81%)
Mutual labels:  stream-api
stream
Stream API for Go.
Stars: ✭ 43 (-60.19%)
Mutual labels:  stream-api
java-functional-features-tutorial
This repo is DEPRECATED. Please use https://github.com/bobocode-projects/java-fundamentals-course
Stars: ✭ 15 (-86.11%)
Mutual labels:  stream-api
aws-api-read-stream
Turn an AWS api call into a readable stream
Stars: ✭ 24 (-77.78%)
Mutual labels:  stream-api
tutorial
Tutorials to help you build your first Swim app
Stars: ✭ 27 (-75%)
Mutual labels:  stream-api
linq
LINQ to Objects for Java.
Stars: ✭ 151 (+39.81%)
Mutual labels:  stream-api
java9-module-examples
a list of Java 9 module samples to dive into the modular world
Stars: ✭ 25 (-76.85%)
Mutual labels:  java9
RentLio
This is a vehicle reservation system. Which is made with JavaFX and also using hibernate and RMI.
Stars: ✭ 49 (-54.63%)
Mutual labels:  java9
android-retroflow
Backport of Java 9 (JEP 266) reactive-streams Flow and SubmissionPublisher API for Android Studio 3.x D8 / desugar toolchain, forked from https://github.com/stefan-zobel/streamsupport
Stars: ✭ 20 (-81.48%)
Mutual labels:  java9
chainsaw
Gradle plugin: adds support for building Java 9 modules.
Stars: ✭ 71 (-34.26%)
Mutual labels:  java9

Maven Central javadoc.io

android-retrostreams

android-retrostreams is a fork of the streamsupport library targeted at Android developers who want to take advantage of Android Studio 3.x D8 / desugar toolchain's capability to use interface default & static methods across Jar file boundaries.

Utilizing this feature of desugar, the streamsupport API can be even more aligned with the original Java 8 / 9 API exposed in the java.util.function and java.util.stream packages. That allows for Android app's code to be much more in accordance with the standard Java 8 / 9 usage than it is now possible with the original streamsupport API (which is bound by the restrictions of supporting Java 6).

With respect to static / default interface methods the android-retrostreams public API should now be identical to the Java 9 API wherever this is possible (i.e. for all interfaces that have first been introduced in Java 8).

Supplemental helper classes, public static methods and so on that served as a replacement for the default / static interfaces methods in the original streamsupport API are now mostly gone. E.g., no j8.u.s.RefStreams class anymore - all these methods are now in the j9.u.s.Stream interface.

The retrostreams API lives in the packages java9.util.* and java9.lang respectively. So, it's not possible to simply import the java.util.stream package in your code - you'd rather have to use java9.util.stream instead. While that is fine as long as you have full control over your source code there is the other common scenario of using a binary 3rd party dependency that has been compiled against the standard Java 8 java.util.stream API. In the latter case bytecode rewriting via ProGuard might be an option. ProGuard supports most Java 8 language features and the latest release can also replace the standard Java 8 stream API by the streamsupport backport (cf. the Proguard documentation, especially the section titled "Java 8 stream API support"), i.e., in this case, switching to the older streamsupport backport instead of using android-retrostreams might be the more promising approach.

The online Javadoc gives a picture of the API changes.

The current stable release of retrostreams is android-retrostreams-1.7.4.

Please give feedback here if you experience any problems.

build.gradle:

dependencies {
    implementation 'net.sourceforge.streamsupport:android-retrostreams:1.7.4'
}

All-in-One JAR:

Contains android-retrostreams core + retroatomic + retroflow + retrofuture

dependencies {
    implementation 'net.sourceforge.streamsupport:android-retrostreams_all:1.7.4'
}

Example usage

import java.util.List;
import java9.util.stream.Stream;
import java9.util.stream.StreamSupport;
import static java9.util.stream.Collectors.toList;

List<Integer> list = Stream.of(1, 2, 3, 4).collect(toList());

List<Integer> incremented = StreamSupport.stream(list)
        .map(i -> i + 1)
        .collect(toList());

Sibling projects

You might also have a use for one of retrostreams' sibling projects:

LICENSE

GNU General Public License, version 2, with the Classpath Exception (and CC0 1.0 for JSR-166 derived code)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].