Java 8 Streams
By Sven Ruppert
()
About this ebook
mit Lambdas. Zusammen ergeben diese beiden Dinge sehr effektive Werkzeuge für den Entwickler. Wir schauen uns an, was genau diese Streams sind, wie man sie
einsetzen kann und welche Vorteile sich aus dem Einsatz ergeben. Beispiele aus dem Bereich der Nebenläufigkeit und der Integration in JavaFX zeigen auf, wie
Streams in der täglichen Arbeit eingesetzt werden können. Dieses Buch richtet sich an alle Entwickler, die sich im Detail mit dem Einsatz von Java 8 beschäftigen wollen, egal, ob für das große neue Projekt oder die Migration eines Altprojekts. Java 8 und insbesondere die neuen Streams werden Ihnen Spaß machen, gehen Sie es an!
Read more from Sven Ruppert
schnell + kompakt
Related to Java 8 Streams
Titles in the series (100)
Erfolgreiche Spieleentwicklung: OpenGL, OpenAL und KI Rating: 0 out of 5 stars0 ratingsJava EE Security Rating: 0 out of 5 stars0 ratingsServiceorientierte Architektur: Anforderungen, Konzeption und Praxiserfahrungen Rating: 0 out of 5 stars0 ratingsNFC: Near Field Communication für Android-Entwickler Rating: 5 out of 5 stars5/5Einstieg in Google Go Rating: 0 out of 5 stars0 ratingsAmazon Web Services für .NET Entwickler Rating: 0 out of 5 stars0 ratingsIT Wissensmanagement: Theorie und Praxis Rating: 0 out of 5 stars0 ratingsSharePoint-Entwicklung für Einsteiger Rating: 0 out of 5 stars0 ratingsTFS 2012 Versionskontrolle: Grundlagen, Check-In Policies und Branch-Modelle Rating: 0 out of 5 stars0 ratingsAlgorithmen: Grundlagen und Implementierung Rating: 0 out of 5 stars0 ratingsErfolgreiche Spieleentwicklung: OpenCL Rating: 0 out of 5 stars0 ratingsJavaScript für Eclipse-Entwickler: Orion, RAP und GWT Rating: 0 out of 5 stars0 ratingsEclipse meets Java FX Rating: 0 out of 5 stars0 ratingsBPM: Strategien und Anwendungsfälle Rating: 0 out of 5 stars0 ratingsSkalierbare Softwaresysteme: Design, Betrieb und Optimierungspotenziale Rating: 0 out of 5 stars0 ratingsHTML5 für Mobile Web Rating: 0 out of 5 stars0 ratingsHTML5 Security Rating: 0 out of 5 stars0 ratingsJavaScript auf dem Server Rating: 0 out of 5 stars0 ratingsJava 7: Fork-Join-Framework und Phaser Rating: 0 out of 5 stars0 ratingsGeolocation mit PHP: Foursquare-API, Google Places & Qype Rating: 0 out of 5 stars0 ratingsUX Design für Tablet-Websites: Ein Überblick Rating: 0 out of 5 stars0 ratingsF#: Ein praktischer Einstieg Rating: 0 out of 5 stars0 ratingsÜberzeugende Präsentationen: Konzeption, Technik und Design Rating: 0 out of 5 stars0 ratingsTFS 2012 TFS 2012 Team Build - Architektur und Installation: Architektur und Installation Rating: 0 out of 5 stars0 ratingsApache Tapestry: Einstieg in die komponentenorientierte Webentwicklung Rating: 0 out of 5 stars0 ratingsMobile Business: Was Entscheider morgen wissen müssen Rating: 0 out of 5 stars0 ratingsBig Data: Technologiegrundlagen Rating: 0 out of 5 stars0 ratingsVaadin Schnelleinstieg Rating: 0 out of 5 stars0 ratingsOAuth 2.0: Client & Server Rating: 0 out of 5 stars0 ratingsNutzeraspekte in Suchmaschinen: Komponenten für eine gelungene Usability-Gestaltung Rating: 0 out of 5 stars0 ratings
Related ebooks
JavaScript effektiv: 68 Dinge, die ein guter JavaScript-Entwickler wissen sollte Rating: 0 out of 5 stars0 ratingsJava 9 Streams Rating: 0 out of 5 stars0 ratingsPowerShell: Anwendung und effektive Nutzung Rating: 5 out of 5 stars5/5C# 8.0 – kurz & gut Rating: 0 out of 5 stars0 ratingsDSL mit Xtext/Xtend. 4GL mit externem Quellcode Rating: 0 out of 5 stars0 ratingsC# 10 – kurz & gut Rating: 0 out of 5 stars0 ratingsWeb-APIs mit ASP.NET MVC 6 Rating: 0 out of 5 stars0 ratingsEnterprise Java Web Services Rating: 0 out of 5 stars0 ratingsNebenläufigkeit in Java und C++ Rating: 0 out of 5 stars0 ratingsAngular 2: Moderne Frontends für alle Plattformen entwickeln Rating: 0 out of 5 stars0 ratingsClojure: Funktionale Programmierung für die JVM Rating: 0 out of 5 stars0 ratingsC# 6.0 – kurz & gut Rating: 5 out of 5 stars5/5Big Data: Datenverarbeitung basierend auf MOM und SQL Rating: 0 out of 5 stars0 ratingsWeb Services mit Apache CXF: Schnell und einfach erklärt Rating: 0 out of 5 stars0 ratingsApache Kafka Rating: 0 out of 5 stars0 ratingsASP.NET Core: Eine Einführung Rating: 0 out of 5 stars0 ratingsElasticsearch: Clientnutzung, Datenvisualisierung und Apache Lucene Rating: 0 out of 5 stars0 ratingsA++ und systemnahe Programmiersprachen: Funktional programmieren in C/C++ Rating: 0 out of 5 stars0 ratingsJava 7: Fork-Join-Framework und Phaser Rating: 0 out of 5 stars0 ratingsApache Tapestry: Einstieg in die komponentenorientierte Webentwicklung Rating: 0 out of 5 stars0 ratingsAlgorithmen: Grundlagen und Implementierung Rating: 0 out of 5 stars0 ratingsDas Vulkan-API: Teil 2: Wie man ein Framework erstellt und Shader programmiert Rating: 0 out of 5 stars0 ratingsModerne Webanwendungen mit AngularJS Rating: 0 out of 5 stars0 ratingsFrequenzverhalten linearer Systeme: Kompendium Simulation und Regelung technischer Prozesse, Teil 7 Rating: 0 out of 5 stars0 ratingsSharePoint Kompendium - Bd. 16 Rating: 0 out of 5 stars0 ratingsSAP Schnittstellen Programmierung mit RFC und VBA: SAP Daten mit MS Access bearbeiten Rating: 0 out of 5 stars0 ratingsSprachenkompendium: Vala, Go und Rust Rating: 0 out of 5 stars0 ratingsSpock, Geb und Selenium: Testframeworks unter die Lupe genommen Rating: 0 out of 5 stars0 ratingsProgrammieren lernen mit A++: Funktional programmieren in Python und Java Rating: 0 out of 5 stars0 ratingsRuby Pakete 100 Stöße: Eine Stunde Meisterklasse, Ausgabe 2024 Rating: 0 out of 5 stars0 ratings
Programming For You
Microsoft Word 2016 (Microsoft Press): Einfache Anleitungen für wichtige Aufgaben Rating: 0 out of 5 stars0 ratingsHTML5-Programmierung von Kopf bis Fuß: Webanwendungen mit HTML5 und JavaScript Rating: 0 out of 5 stars0 ratingsHausautomation mit Raspberry Pi: Alarmanlage, Heizung, Smart Home, W-LAN & Co: 20 Projekte, die Ihr Leben leichter machen Rating: 0 out of 5 stars0 ratingsDie ultimative QNAP NAS Bibel - Das Praxisbuch - mit vielen Insider Tipps und Tricks - komplett in Farbe Rating: 0 out of 5 stars0 ratingsPython-Grundlagen Rating: 0 out of 5 stars0 ratingsProgrammieren lernen mit Python 3: Schnelleinstieg für Beginner Rating: 0 out of 5 stars0 ratingsPython kurz & gut: Für Python 3.x und 2.7 Rating: 3 out of 5 stars3/5Raspberry Pi: Mach's einfach: Die kompakteste Gebrauchsanweisung mit 222 Anleitungen. Geeignet für Raspberry Pi 3 Modell B / B+ Rating: 0 out of 5 stars0 ratingsSQL – kurz & gut Rating: 0 out of 5 stars0 ratingsAndroid-Entwicklung für Einsteiger - 20.000 Zeilen unter dem Meer: 2. erweiterte Auflage Rating: 0 out of 5 stars0 ratingsRaspberry Pi: Einstieg • Optimierung • Projekte Rating: 5 out of 5 stars5/5Das Franzis Starterpaket Arduino Uno: Das Handbuch für den Schnelleinstieg Rating: 0 out of 5 stars0 ratingsDas große Python3 Workbook: Mit vielen Beispielen und Übungen - Programmieren leicht gemacht! Rating: 4 out of 5 stars4/5Hacken mit Python und Kali-Linux: Entwicklung eigener Hackingtools mit Python unter Kali-Linux Rating: 0 out of 5 stars0 ratingsMikrocontroller in der Elektronik: Mikrocontroller programmieren und in der Praxis einsetzen Rating: 0 out of 5 stars0 ratingsPython | Schritt für Schritt Programmieren lernen: Der ultimative Anfänger Guide für einen einfachen & schnellen Einstieg Rating: 0 out of 5 stars0 ratingsEigene Spiele programmieren – Python lernen: Der spielerische Weg zur Programmiersprache Rating: 0 out of 5 stars0 ratingsPraktisches Programmieren in C: Grundlagen und Tipps Rating: 0 out of 5 stars0 ratingsC++: Eine kompakte Einführung Rating: 0 out of 5 stars0 ratingsJava 8 - Die Neuerungen: Lambdas, Streams, Date and Time API und JavaFX 8 im Überblick Rating: 0 out of 5 stars0 ratingsAndroid-Programmierung kurz & gut Rating: 0 out of 5 stars0 ratingsSQL von Kopf bis Fuß Rating: 4 out of 5 stars4/5Linux Grundlagen - Ein Einstieg in das Linux-Betriebssystem Rating: 0 out of 5 stars0 ratingsProgrammieren von Kopf bis Fuß Rating: 4 out of 5 stars4/5C von Kopf bis Fuß Rating: 3 out of 5 stars3/5Vue.js für alle: Wissenswertes für Einsteiger und Experten Rating: 0 out of 5 stars0 ratingsProgrammieren für Einsteiger: Teil 1 Rating: 0 out of 5 stars0 ratingsJavaScript kurz & gut Rating: 3 out of 5 stars3/5JavaScript kinderleicht!: Einfach programmieren lernen mit der Sprache des Web Rating: 0 out of 5 stars0 ratings
Reviews for Java 8 Streams
0 ratings0 reviews
Book preview
Java 8 Streams - Sven Ruppert
https://bitbucket.org/rapidpm/entwicklerpress-shortcut-jdk8-streams.
1 Data in – Data out
1.1 Was waren nochmal diese Streams?
Jeder ist in Java schon einmal mit irgendeiner Form von Streams konfrontiert worden. Aber was genau macht einen Stream nun im JDK 8 aus?
Streams sind keine Datenstruktur, was so viel bedeutet, dass sie keinen Storage für Daten darstellen. Es handelt sich eher um eine Pipeline für Datenströme. In dieser Pipeline werden verschiedene Transformationen auf die Daten angewendet. In diesem speziellen Fall werden die Transformationen nicht auf den Daten der Quellstruktur selbst durchgeführt. Die zugrunde liegenden Datenstrukturen wie Arrays oder Listen werden also nicht verändert. Ein Stream wrappt also die Datenstruktur, entnimmt ihr die Quelldaten und arbeitet auf Kopien.
Streams sind für den Einsatz von Lambdas konzipiert worden. Es gibt also keine Streams ohne Lambdas, was kein Problem darstellt, da Streams und Lambdas zusammen im JDK 8 enthalten sind.
Streams bieten keinen wahlfreien Zugriff per Index oder Ähnliches auf die Quelldaten. Der Zugriff auf das erste Element ist möglich, nicht jedoch auf beliebige nachfolgende Elemente.
Streams bieten guten Support, um die Ergebnisse selbst wieder als z. B. Array oder List zur Verfügung zu stellen.
Streams sind lazy organisiert. Das bedeutet, dass die Elemente erst geholt werden, wenn die Operation auf ihnen angewendet werden soll. Besteht die Datenquelle aus 1 000 Elementen, dann dauert der erste Zugriff nicht 1 000 Zeiteinheiten, sondern eine Zeiteinheit (vorausgesetzt, der Zugriff auf ein Element ist linear im Zeitverbrauch).
Streams sind parallel, wenn gewünscht. Die Streams kann man prinzipiell in zwei Hauptgruppen unterteilen: in serielle und parallele Implementierungen. Wenn also Operationen atomar und ohne Invarianten durchgeführt werden können, wird kein typischer multi-threaded Code notwendig, um die im System schlafenden Cores zu verwenden.
Streams sind ungebunden, da sie nicht wie Collections initial befüllt werden. Damit sind Streams auch unendlich. Es können Generatorfunktionen angegeben werden, die für die permanente Lieferung von Quelldaten sorgen, die erzeugt werden, wenn der Client Elemente des Streams konsumiert.
1.2 Wo kommen all die Quelldaten her?
Wenn man daran denkt, dass Streams nicht wie Collections ihre eigenen Daten halten, dann stellt sich die Frage, wo sie dann herkommen. Die gebräuchlichste Art, Streams zu erzeugen, ist die Verwendung der Methoden, um aus einer festen Anzahl von Elementen einen Stream zu erzeugen. Das sind dementsprechend die Methoden Stream.of(val1,val2,val3…), Stream.of(array) und list.stream(). Zu den Methoden aus dem