streamsupport


Source link: https://github.com/streamsupport/streamsupport

Import from http://hg.code.sf.net/p/streamsupport/code

streamsupport is a backport of the Java 8 java.util.function (functional interfaces) and java.util.stream (streams) API for users of Java 6 or 7 supplemented with selected additions from java.util.concurrent which didn't exist back in Java 6.

Due to the lack of default interface methods and static interface methods in pre-Java 8 the API had to be slightly adjusted in these areas but still covers the full functionality scope of Java 8. In detail, static and default interface methods have been moved to companion classes in the same package that bear the identical name as the interface but with an "s" appended (e.g. Comparator -> Comparators).

For ease of use, the default methods for most of the functional interfaces were NOT retained as abstract methods in the redefined interfaces (keeping them single method interfaces) - the missing default (and static) methods can always be found in the corresponding companion class.

Want also lambdas? https://github.com/orfjackal/retrolambda

streamsupport Web Site

Categories

Libraries

Features

  • Java 8 Streams library backport
  • Java 8 CompletableFuture backport
  • Java 8 Parallel array operations backport
  • Java 8 Functional interfaces backport
  • Further java.util.concurrent enhancements from Java 7/8 backported to Java 6
  • Includes miscellaneous Java 8 goodies (Optional, StringJoiner, ...)
  • Supports Android

Usage

After:

RefStreams.of("one", "two", "three", "four")
  .filter(e -> e.length() > 3)
  .peek(e -> System.out.println("Filtered value: " + e))
  .map(String::toUpperCase)
  .peek(e -> System.out.println("Mapped value: " + e))
  .collect(Collectors.toList());

After:

public static List<String> getNames(List<User> users) {

  return StreamSupport.stream(users).map(user -> user.name()).collect(Collectors.toList());
 
}

After:

public static String[] getNames(User[] users) {

  return J8Arrays.stream(users).map(user -> user.name()).toArray(length -> new String[length]);
 
}

Installation

build.gradle:

repositories {

  jcenter()
  maven {
 url "https://jitpack.io" 
}
 
}
  dependencies {

  compile 'net.sourceforge.streamsupport:streamsupport:1.5.6'
  compile 'net.sourceforge.streamsupport:streamsupport-cfuture:1.5.6'
  compile 'net.sourceforge.streamsupport:streamsupport-atomic:1.5.6'
  compile 'net.sourceforge.streamsupport:streamsupport-flow:1.5.6'
  compile 'net.sourceforge.streamsupport:streamsupport-literal:1.5.6'

//compile 'com.github.streamsupport.streamsupport:streamsupport-pro:-SNAPSHOT' // proguard config for android 
}

or via jitpack:

repositories {

  jcenter()
  maven {
 url "https://jitpack.io" 
}
 
}
  dependencies {

  compile 'com.github.streamsupport.streamsupport:streamsupport:-SNAPSHOT'
  compile 'com.github.streamsupport.streamsupport:streamsupport-cfuture:-SNAPSHOT'
  compile 'com.github.streamsupport.streamsupport:streamsupport-atomic:-SNAPSHOT'
  compile 'com.github.streamsupport.streamsupport:streamsupport-flow:-SNAPSHOT'
  compile 'com.github.streamsupport.streamsupport:streamsupport-literal:-SNAPSHOT'

//compile 'com.github.streamsupport.streamsupport:streamsupport-pro:-SNAPSHOT' // proguard config for android 
}

Proguard

streamsupport.pro

Build

maven

./mvnw clean install

gradle

./gradlew clean assemble

Importing

GIT_COMMITTER_NAME="" GIT_COMMITTER_EMAIL="" git rebase --committer-date-is-author-date 1.5.5 1.5.6 --onto _1.5.5

Release Notes

Release Notes

LICENSE

GPL2, CE (GNU General Public License, version 2, with the Classpath Exception)

Resources

An Android library to retrofit multiple item view types.

Retrofit your Android layout XML files.

It will adjust your attributes order in accordance with the rules, and it will adjust some attributes to the front, and take some attributes at the end of the rows. It will make your code format more nice.

A better substitute good of AsyncTask.

This is a stereo view(3D) for Android.

Floating Action Menu for Android.

An animated alternative to SearchView widget.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes