In this, we are discuss about Java 8 Streams. Common Operations . Java 8 Streams are huge topic, so i am not cover all the things, but try to cover the basics operations of Streams. Before this, please refer my previous presentation "Functional programming in java 8", because of clear some basic concept for functional programming. For the reference use Java 8 API docs.
Cover Basic concept for Functional Programming in Java. Define new functional interfaces, lambda expressions, how to translate lambda expression, JVM deal with new byte code etc. This is not the perfect slides for functional programming, but trying cover simple basic functional programming.
Presentation provides introduction and detailed explanation of the Java 8 Lambda and Streams. Lambda covers with Method references, default methods and Streams covers with stream operations,types of streams, collectors. Also streams are elaborated with parallel streams and benchmarking comparison of sequential and parallel streams.
Additional slides are covered with Optional, Splitators, certain projects based on lambda and streams
Cover Basic concept for Functional Programming in Java. Define new functional interfaces, lambda expressions, how to translate lambda expression, JVM deal with new byte code etc. This is not the perfect slides for functional programming, but trying cover simple basic functional programming.
Presentation provides introduction and detailed explanation of the Java 8 Lambda and Streams. Lambda covers with Method references, default methods and Streams covers with stream operations,types of streams, collectors. Also streams are elaborated with parallel streams and benchmarking comparison of sequential and parallel streams.
Additional slides are covered with Optional, Splitators, certain projects based on lambda and streams
In this Meetup Victor Perepelitsky - R&D Technical Leader at LivePerson leading the 'Real Time Event Processing Platform' team , will talk about Java 8', 'Stream API', 'Lambda', and 'Method reference'.
Victor will clarify what functional programming is and how can you use java 8 in order to create better software.
Victor will also cover some pain points that Java 8 did not solve regarding functionality and see how you can work around it.
Java is Object Oriented Programming. Java 8 is the latest version of the Java which is used by many companies for the development in many areas. Mobile, Web, Standalone applications.
Java 8 is coming soon. In this presentation I have outlined the major Java 8 features. You get information about interface improvements, functional interfaces, method references, lambdas, java.util.function, java.util.stream
Start programming in a more functional style in Java. This is the second in a two part series on lambdas and streams in Java 8 presented at the JoziJug.
In this, we discuss about following Points:
1. What is Big -Data
2. Why Graph Database involved?
3. What is Neo4J?
4. Neo4J Cypher Query Language.
5. Spring-Data-Neo4j Sample Application.
In this Meetup Victor Perepelitsky - R&D Technical Leader at LivePerson leading the 'Real Time Event Processing Platform' team , will talk about Java 8', 'Stream API', 'Lambda', and 'Method reference'.
Victor will clarify what functional programming is and how can you use java 8 in order to create better software.
Victor will also cover some pain points that Java 8 did not solve regarding functionality and see how you can work around it.
Java is Object Oriented Programming. Java 8 is the latest version of the Java which is used by many companies for the development in many areas. Mobile, Web, Standalone applications.
Java 8 is coming soon. In this presentation I have outlined the major Java 8 features. You get information about interface improvements, functional interfaces, method references, lambdas, java.util.function, java.util.stream
Start programming in a more functional style in Java. This is the second in a two part series on lambdas and streams in Java 8 presented at the JoziJug.
In this, we discuss about following Points:
1. What is Big -Data
2. Why Graph Database involved?
3. What is Neo4J?
4. Neo4J Cypher Query Language.
5. Spring-Data-Neo4j Sample Application.
Define location of Preplaced cells(http://www.vlsisystemdesign.com/PD-Flow.php)VLSI SYSTEM Design
https://www.udemy.com/vlsi-academy
During placement and routing, most of the placement tools, place/move logic cells based on floorplan specifications. Some of the important or critical cell's locations has to be pre-defined before actual placement and routing stages. The critical cells are mostly the cells related to clocks, viz. clock buffers, clock mux, etc. and also few other cells such as RAM's, ROM,s etc. Since, these cells are placed in to core before placement and routing stage, they are called 'preplaced cells'.
In Actors system, we can change State or Behaviors during runtime in actors. There are multiple ways for changing behaviors like conditional based and Hotswap but Finite State Machine(FSM) is the cleanest way. If we have finite number of state in our system then FSM is the good practice.
Identity and access management (IAM) is the security discipline that enables the right individuals to access the right resources at the right times for the right reasons. IAM enables you to securely control access to your application or product services and resources for your users.
Harnessing the Power of Java 8 Streams IndicThreads
Presented at the IndicThreads.com Software Development Conference 2016 held in Pune, India. More at http://www.IndicThreads.com and http://Pune16.IndicThreads.com
--
The new Java 8 stream library is the most exciting addition to come to Java in a long time. It allows entire algorithms to be expressed in one line, parallelism to be obtained on-demand, and plumbing code to be flushed down the drain. This presentation will show you how to think in streams, effective parallelization, plus advanced concepts like mutable reduction and declarative collection. Write better code with streams. This presentation will show you how.
This presentaion provides and overview of the new features of Java 8, namely default methods, functional interfaces, lambdas, method references, streams and Optional vs NullPointerException.
This presentation by Arkadii Tetelman (Lead Software Engineer, GlobalLogic) was delivered at Java.io 3.0 conference in Kharkiv on March 22, 2016.
This is a beginner's guide to Java 8 Lambdas, accompnied with executable code examples which you can find at https://github.com/manvendrasinghkadam/java8streams. Java 8 Streams are based on Lambdas, so this presentation assumes you know Lambdas quite well. If don't then please let me know I'll create another presentation regarding it with code examples. Lambdas are relatively easy to use and with the power of stream api you can do functional programming in Java right from start. This is very cool to be a Java programmer now.
Journey into Reactive Streams and Akka StreamsKevin Webber
Are streams just collections? What's the difference between Java 8 streams and Reactive Streams? How do I implement Reactive Streams with Akka? Pub/sub, dynamic push/pull, non-blocking, non-dropping; these are some of the other concepts covered. We'll also discuss how to leverage streams in a real-world application.
(7) c sharp introduction_advanvced_features_part_iiNico Ludwig
This presentation comes with many additional notes (pdf): http://de.slideshare.net/nicolayludwig/7-c-sharp-introductionadvanvcedfeaturespartii-38640489
Check out these exercises: http://de.slideshare.net/nicolayludwig/6-7-c-sharp-introductionadvancedfeaturespartipartiiexercises
- Object-based and generic Collections
- Delegates and Events
- Custom Attributes
- Reflection
Presenter - Siyuan Hua, Apache Apex PMC Member & DataTorrent Engineer
Apache Apex provides a DAG construction API that gives the developers full control over the logical plan. Some use cases don't require all of that flexibility, at least so it may appear initially. Also a large part of the audience may be more familiar with an API that exhibits more functional programming flavor, such as the new Java 8 Stream interfaces and the Apache Flink and Spark-Streaming API. Thus, to make Apex beginners to get simple first app running with familiar API, we are now providing the Stream API on top of the existing DAG API. The Stream API is designed to be easy to use yet flexible to extend and compatible with the native Apex API. This means, developers can construct their application in a way similar to Flink, Spark but also have the power to fine tune the DAG at will. Per our roadmap, the Stream API will closely follow Apache Beam (aka Google Data Flow) model. In the future, you should be able to either easily run Beam applications with the Apex Engine or express an existing application in a more declarative style.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
1. Java 8 Streams
&
Common Operations
By Harmeet Singh(Taara)
(Java EE Developer)
Email: harmeetsingh.0013@gmail.com
Blog: http://harmeetsingh13.blogspot.in
Skype: harmeetsingh0013
Contact: Via Email or Skype
2. Contents
➢ Introduction
➢ High-Order Functions
➢ Effective Final Variables
➢ Lexical-Scoping
➢ Method References
➢ Internal-Iterators
➢ External-Iterators
➢ Stream’s Common’s Operation
➢ Stream’s Collectors
➢ Optional Class
➢ Leftover: The Things We Didn’t Cover
3. Acknowledgment
➢ Special Thanks To My Parents.
➢ Thanks To All, Who Support Me or Not.
➢ Dedicated To My Teacher “Mr. Kapil Sakhuja”
➢ Thanks To Insonix.
4. Introduction
Today, We cover Java 8 Stream API’s for remove some
‘Boilerplate Code’ from our daily programming. In Java,
Some time we need to write some common practices with
our collections for fetching the elements and do some
operations.
This make’s our code dirty. Java 8 Streams provide some
powerful operations for our collections libraries. It is
basically perform operation like SQL queries on java
collections.
(Download Examples :
https://github.com/harmeetsingh0013/Java8-Streams-
Examples.git)
5. Higher-Order Functions
➢ In OO-Programming we’re using passing objects to
methods, creating Objects with in method and
returning objects from within method.
➢ Higher-Order Functions do to functions what methods
did to objects.
➢ With Higher-Order Functions we can:-
○ Pass Functions-to-Functions.
○ Create Functions-within-Functions.
○ Return Functions-from-Functions.
7. Effective Final Variable
➢ Effective final variables whose values is never changed
after initialized. Imagine Adding a ‘final’ modifier to
variable declaration.
➢ Example:-
8. Lexical-Scoping
➢ Lexical-Scoping is the way to declare, specific-scope
of variables and it is only accessible with in that
region.
➢ Two Types Of Lexical Scope.
○ Static Lexical-Scope.
○ Dynamic Lexical-Scope.
➢ Static Lexical-Scope:- The Scope of variable is
declare at compile phase.
9. Lexical-Scoping
➢ Dynamic Lexical-Scope:- In this, First look for a
local definition of a variable. If isn’t find, we look up
the calling stack for a definition.
➢ Example:-
10. Method-References
➢ Method References gives you compact, easy-to-read lambda
expressions for method that already have a name.
➢ Example:
() -> “string”.length();
TO
String::length;
➢ There are FOUR types of method reference:-
○ Reference to a static method.
○ Reference to an instance method of a particular object.
○ Reference to an instance method of an arbitrary object
of a particular type.
○ Reference to a constructor.
12. Internal-Iterators
➢ The iteration control by iterator not by user.
➢ In this, user pass only the expression, that apply on
our Collection or Data-Structures.
➢ User only need to concentrate on Business logic.
➢ Example:-
14. Stream’s Common Operations
➢ A Stream is a tool for building up complex operations on
collections using functional approach.
➢ The streams are act as a commands in unix operating
system, in which one command output is input of another
command.
➢ Stream create pipeline for performing operations. These
pipeline is also perform as parallel.
➢ Streams are also deal which Primitives type. But only with
‘int’, ‘long’ and ‘double’.
➢ Java 8 Steam provide ome special interfaces for primitive
types as follow
○ LongStream
○ IntStream
○ DoubleStream
15. Stream’s Common Operations
➢ Stream is divided into 3 parts:-
○ Declaration
○ Intermediate
○ Termination
➢ Example:-
16. Stream’s Common Operations
➢ Stream Intermediate Operations are lazily loading. Without
Termination Operation, the Intermediate operation not
perform any action. When termination operation found the
intermediate operation perform task.
➢ There are lots of Intermediate and Termination
operations, but some important we discuss as follow:-
○ filter(Predicated<? super T> predicate)
○ map(Function<? super T, ? extends R> mapper)
○ flatMap(Function<? super T, ? extends Stream<? super
R>> mapper)
○ forEach(Consumer<? super T> action)
○ peek(Consumer<? super T> action)
○ reduce(BinaryOperator<T> accumulator)
17. Stream’s Common Operations
➢ Stream<T> filter(Predicated<? super T> predicate);
filter build up the Stream recipe, but don’t force this recipe
to be used. They provide lazy behaviour.
Example:
18. Stream’s Common Operations
➢ <R> Stream<R> map(Function<? super T, ? extends R>
mapper);
map If we want to convert one type of value to another type,
map gives you the way “Apply Function to a Stream of values,
producing another stream of the new values”.
Example:
19. Stream’s Common Operations
➢ <R> Stream<R> flatMap(Function<? super T, ? extends
Stream<? super R>> mapper);
flatMap If we have multiple Streams of same type, and we need
to concat all the streams together and return one common
Stream, Then flatmap provide the way concatenates all the
stream together
Example:
20. Stream’s Common Operations
➢ void forEach(Consumer<? super T> action);
forEach It is a Terminal Operation, perform an action for each
element of the stream. The behaviour of this operation is
explicitly nondeterministic.
Example:
21. Stream’s Common Operations
➢ Stream<T> peek(Consumer<? super T> action);
peek, It is an Intermediate Operation, performing an provided
action on each element as elements are consumed from the
resulting stream.
Example:
22. Stream’s Common Operations
➢ Stream<T> reduce(BinaryOperator<T> accumulator);
➢reduce It is based on reduction operation, take a
sequence of input elements and combine them into single
summary result by repeated application of a combining
operation such as :-
○ Finding the sum.
○ Maximum of set of numbers.
○ Accumulating elements into a list.
➢ reduce, Operation Follows reduce pattern
23. Stream’s Common Operations
➢Now we solve the previous problem with the help of reduce
Operation in Stream. This is Terminal Operation.
Example:
24. Stream’s Collectors
➢ Java 8 Streams have rich of collectors, which provide some
interesting operations perform on collections, like in sql
queries group by, order by etc.
➢ Today we discuss some important collectors :-
○ collect(Collector<? super T, A, R> collector);
○ toList(), toSet() and toMap();
○ toCollection(Supplier<C> collectionFactory);
○ maxBy, minBy and averagingInt(ToIntFunction<? super
T> mapper);
○ partitioningBy(Predicate<? super T> preidicate);
○ groupingBy(Function<? super T, ? extends K>
classifier);
○ joining(CharSequence delimiter, CharSequence prefix,
CharSequence suffix);
25. Stream’s Collectors
➢ <R, A> R collect(Collector<? super T, A, R> collector);
➢ The Method is a reduce operation that’s useful for
transforming the collection into another form, often a
mutable collection.
➢ This method can perform parallel additions, as appropriate,
into different sublists, and then merge them in a thread-
safe manner into a large list.
➢ This is a Terminal Operation.
➢ The version of collect method accept Collector object
and Java provide us Collectors Utility class, which have
several utility methods, used for generate lists, set and
map. Methods as follow:-
○ toList();
○ toSet();
○ toMap();
26. Stream’s Collectors
➢ <T> Collector<T, ?, List<T>> toList();
➢ The Method return the List that accumulates the input
element into a new List. There is no guarantees on the
type, mutability, serializability or thread-safety of the
List return.
➢ There is no-guarantee it produce the implementation of
ArrayList or other. If we need Basic Collections
implementation use toCollection() method.
27. Stream’s Collectors
➢ <T> Collector<T, ?, Set<T>> toSet();
➢ The Method return the Set that accumulates the input
element into a new Set. There is no guarantees on the
type, mutability, serializability or thread-safety of the
List return.
➢ There is no-guarantee it produce the implementation of
HashSet or other. If we need Basic Collections
implementation use toCollection() method.
28. Stream’s Collectors
➢ <T, K, U> Collector<T, ?, Map<K,U>> toMap(Function<?
super T, ? extends K> keyMapper, Function<? super T, ?
extends K> valueMapper);
➢ The Method return the Map whose keys and values are the
result of applying the provided mapping functions to the
input element.
➢ If the mapped keys contain duplicates an
IllegalStateException is thrown when the collection
operation is performed.
29. Stream’s Collectors
➢ <T> Collector<T, ?, Optional<T>> maxBy(Comparator<?
super T> comparator);
➢ Produces the maximal element from given stream,
according to given Comparator and return Optional Object.
30. Stream’s Collectors
➢ <T> Collector<T, ?, Double> minBy(ToIntFunction<? super
T> mapper);
➢ Produces the arithmetic-mean of an integer-valued function
applied to the input elements. If no element are present,
result is 0.
31. Stream’s Collectors
➢ <T> Collector<T, ?, Map<Boolean, List<T>>>
partitioningBy(Predicated<? super T> predicate);
➢ This is a collector that takes a stream and partitions its
content into two groups.
➢ It uses a predicate to determine whether an element
should be a part of true group or the false group and
returns a Map from Boolean to a List of values.
32. Stream’s Collectors
➢ <T, K> Collector<T, ?, Map<K, List<T>>>
groupingBy(Function<? super T, ? extends K>
classifier);
➢ This functions map element to some Key type K.
33. Stream’s Collectors
➢ <T, K> Collector<CharSequence, ?, String>
joining(CharSequence delimiter);
➢ This functions concat the input elements, separated by
specify delimiter.
34. Optional Class
➢ Null is a EVIL
➢ Tony Hoare wrote about null “I call it my billion-dollar
mistake. It was the invention of the null reference in 1965. I
couldn’t resist the temptation to put in a null reference, simply
because it was easy to implement. “
➢ The alternative from functional programming is using a
Option Type, That can contain some value or not.
➢ The Optional Class includes methods to explicitly deal with
cases where a value is present or absent.
➢ Advantage of Optional Class forces to think about the case
when value is not present.
36. Optional Class
➢ Following are the operations we perform with Optional:-
○ Creating Optional Object
○ Do Something if value is present.
○ Default values and actions.
○ Rejecting Certain values using the filter method.
○ Extracting the transform values using the map method.
○ Cascading the Optional object using the flatMap
method.
➢ The above method we discuss filter, map and flatMap
are not stream methods, they are itself optional class
methods. For further methods refer Java 8 API docs.
37. Leftover: The Important Topics We Didn’t Cover
1. Method Handlers
2. Default Methods And Static Methods In
Interface.
3. Java 8 Date API.
4. InvokeDynamic.
5. Concurrency In Lambda’s.
6. Parallel Streams.
7. Design And Architect Principals.
8. Code Refactoring.
9. Custom Collectors.
10.Deep Dive in Optional Class
38. References
➢ Special Thanks to Richard Warburton for “Java 8
lambdas”.
➢ Venkat Subramaniam “Functional Programming In
Java”
➢ Oracle Java API Docs
➢ Raoul-Gabriel Urma “Tierd Of null Pinter Exception”
(http://www.oracle.com/technetwork/articles/java/j
ava8-optional-2175753.html)
Any Many More Like Dzone, StackOverflow etc.