A look on one of the features of Java 8 hidden behind the lambdas. A different way to iterate Collections. You'll never see the Collecions the same way.
These are the slides I used on my talk at the "Tech Thursday" by Oracle in June in Madrid.
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
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.
This talk introduces Spring's REST stack - Spring MVC, Spring HATEOAS, Spring Data REST, Spring Security OAuth and Spring Social - while refining an API to move higher up the Richardson maturity model
Spring Data is a high level SpringSource project whose purpose is to unify and ease the access to different kinds of persistence stores, both relational database systems and NoSQL data stores.
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
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.
This talk introduces Spring's REST stack - Spring MVC, Spring HATEOAS, Spring Data REST, Spring Security OAuth and Spring Social - while refining an API to move higher up the Richardson maturity model
Spring Data is a high level SpringSource project whose purpose is to unify and ease the access to different kinds of persistence stores, both relational database systems and NoSQL data stores.
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.
JavaScript - Chapter 9 - TypeConversion and Regular Expressions WebStackAcademy
Type Conversion:
JavaScript is loosely typed language and most of the time operators automatically convert a value to the right type but there are also cases when we need to explicitly do type conversions.
While JavaScript provides numerous ways to convert data from one type to another but there are two most common data conversions :
Converting Values to String
Converting Values to Numbers
Regular Expressions:
A regular expression is an object that describes a pattern of characters.
The JavaScript RegExp class represents regular expressions, and both String and RegExp define methods that use regular expressions to perform powerful pattern-matching and search-and-replace functions on text.
Not so long ago Microsoft announced a new language trageting on front-end developers. Everybody's reaction was like: Why?!! Is it just Microsoft darting back to Google?!
So, why a new language? JavaScript has its bad parts. Mostly you can avoid them or workaraund. You can emulate class-based OOP style, modules, scoping and even run-time typing. But that is doomed to be clumsy. That's not in the language design. Google has pointed out these flaws, provided a new language and failed. Will the story of TypeScript be any different?
Welcome to presentation on Spring boot which is really great and relatively a new project from Spring.io. Its aim is to simplify creating new spring framework based projects and unify their configurations by applying some conventions. This convention over configuration is already successfully applied in so called modern web based frameworks like Grails, Django, Play framework, Rails etc.
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
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
Java9 Beyond Modularity - Java 9 más allá de la modularidadDavid Gómez García
These are the slides I used for my "Java 9 beyond modularity" at several different local meetups and conferences in Spain during 2017
Java 9 is about to reach its public release scheduled for September 2017. If we ask what are the new features that this new version will include, probably the first that comes to our head is modularity.
But java 9 brings with a lot of features beyound Jigsaw, JPMS or modularity. In this talk we will talk about at least 9 other new features that include this new version of Java that are interesting and maybe will end up being more used than the modularity itself for those who embrace the new version.
Those are changes that come to complement and improve even more the set of new tools (like Streams, Optionals, etc...) that Java 8 brought to us.
We'll take a look at small changes in language syntax (such as new ways of using try-with-resources), changes in Collections APIs and Streams, new tools like VarHandles, new APIs such as the Flow API, and As we allow the inclusion of reactive programming with Java.
Do you want to see in Java 9 beyond modularity? Do you want to have a more complete view of what you can provide? Let's take a look toghether!
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.
JavaScript - Chapter 9 - TypeConversion and Regular Expressions WebStackAcademy
Type Conversion:
JavaScript is loosely typed language and most of the time operators automatically convert a value to the right type but there are also cases when we need to explicitly do type conversions.
While JavaScript provides numerous ways to convert data from one type to another but there are two most common data conversions :
Converting Values to String
Converting Values to Numbers
Regular Expressions:
A regular expression is an object that describes a pattern of characters.
The JavaScript RegExp class represents regular expressions, and both String and RegExp define methods that use regular expressions to perform powerful pattern-matching and search-and-replace functions on text.
Not so long ago Microsoft announced a new language trageting on front-end developers. Everybody's reaction was like: Why?!! Is it just Microsoft darting back to Google?!
So, why a new language? JavaScript has its bad parts. Mostly you can avoid them or workaraund. You can emulate class-based OOP style, modules, scoping and even run-time typing. But that is doomed to be clumsy. That's not in the language design. Google has pointed out these flaws, provided a new language and failed. Will the story of TypeScript be any different?
Welcome to presentation on Spring boot which is really great and relatively a new project from Spring.io. Its aim is to simplify creating new spring framework based projects and unify their configurations by applying some conventions. This convention over configuration is already successfully applied in so called modern web based frameworks like Grails, Django, Play framework, Rails etc.
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
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
Java9 Beyond Modularity - Java 9 más allá de la modularidadDavid Gómez García
These are the slides I used for my "Java 9 beyond modularity" at several different local meetups and conferences in Spain during 2017
Java 9 is about to reach its public release scheduled for September 2017. If we ask what are the new features that this new version will include, probably the first that comes to our head is modularity.
But java 9 brings with a lot of features beyound Jigsaw, JPMS or modularity. In this talk we will talk about at least 9 other new features that include this new version of Java that are interesting and maybe will end up being more used than the modularity itself for those who embrace the new version.
Those are changes that come to complement and improve even more the set of new tools (like Streams, Optionals, etc...) that Java 8 brought to us.
We'll take a look at small changes in language syntax (such as new ways of using try-with-resources), changes in Collections APIs and Streams, new tools like VarHandles, new APIs such as the Flow API, and As we allow the inclusion of reactive programming with Java.
Do you want to see in Java 9 beyond modularity? Do you want to have a more complete view of what you can provide? Let's take a look toghether!
Aim of this presentation is not to make you masters in Java 8 Concurrency, but to help you guide towards that goal. Sometimes it helps just to know that there is some API that might be suitable for a particular situation. Make use of the pointers given to search more and learn more on those topics. Refer to books, Java API Documentation, Blogs etc. to learn more. Examples and demos for all cases discussed will be added to my blog www.javajee.com.
An introduction to the Java Platform Module System (JPMS). This talk is from April 2017, before the Java SE 9 release, so the final details may be subtly different, particularly once a standard becomes established for module names.
Java 9 Modules: The Duke Yet Lives That OSGi Shall DeposeNikita Lipsky
Modules appear in Java 9 at last, but why? After all, OSGi has been around for more than 15 years and serves as the foundation of many desktop, server, and IoT applications. Its authors state that OSGi solves various dependency management problems in the most powerful way - at run time.
In this session, we will explore the problems that OSGi tries to solve, understand its approach, and identify its failures. Then we will figure out which of those problems the authors of Jigsaw ignored (and why), and which ones they solved (and how). Finally, we will talk about the challenges that Jigsaw brings with itself to the Java ecosystem and what we the developers have to do about them.
https://2017.javazone.no/program/83eb9ed50ba74946ad418a3abea0467a
The slides from the talk I gave at Oracle III #JuevesTecnológicos in Madrid.
A review of how the ParallelStreams Work in Java 8 and some considerations we must know in order to get the better performance from the concurrent data processing in #Java8
This is my attempt at a look at some of the features of C++11, and more importantly, describing some of the style changes in C++11 that will make programmers more productive and programs more efficient.
Laziness, trampolines, monoids and other functional amenities: this is not yo...Codemotion
by Mario Fusco - Lambdas are the main feature introduced with Java 8, but the biggest part of Java developers are still not very familliar with the most common functional idioms and patterns. The purpose of this talk is presenting with practical examples concepts like high-order functions, currying, functions composition, persistent data structures, lazy evaluation, recursion, trampolines and monoids showing how to implement them in Java and how thinking functionally can help us to design and develop more readable, reusable, performant, parallelizable and in a word better, code.
When embracing Java 8 we walk down the yellow brick road to the wizard of lambdas. That road usually starts from the fear and terror of learning their syntax until finally getting to understand them and opening our minds to the fruitful fields of functional programming. But this road eventually reaches a final stage: the lambda abuse.
To master the lambdas art means to know when to use them and when not to not damage your brain and, most importantly, other Java developers’. Keep your code readable and maintainable, avoid becoming a lambda addict!
First part of this presentation explains basics and advantages of using functional programming approaches with lambda calculus.
Second part of this presentation explains how can we use lambda calculus in C# 3.0
After migrating a three year old C# project to Java we ending up with a significant portion of legacy code using lambdas in Java. What was some of the good use cases, code which could be written better and the problems we had migrating from C#. At the end we look at the performance implications of using Lambdas.
On March 2014, Java 8 was released. These informal slides describe the new elements of the programming languages, focusing on those taken from the functional paradigm.
Leverage CompletableFutures to handle async queries. DevNexus 2022David Gómez García
Slides used at DevNexus 22 talk.
Completable futures were introduced in Java 8, and they are a powerful mechanism to add concurrency (not parallelism) to your application logic, and it may be handy when dealing with multiple queries to different systems.
If you are a developer, you may make your code more performant by using CompletableFutures where it makes sense.
If you are a library developer, it may be a good thing to offer an API that returns CompletableFutures so that your users will be able to benefit from it.
Building Modular monliths that could scale to microservices (only if they nee...David Gómez García
It’s easy these days to fall into the trap of starting to design your whole application with a microservices architecture…. Because, you know, that’s what everyone is doing, right?
But no, no. I’m not going to deny that Microservices have their advantages, specifically in a distributed and scalable world like the one we need to deal with. The problem may be in the approach we are taking. Are we considering the microservices architecture as a goal, or as a means to a purpose?
In this talk we will think in a different approach: we will go back to the basics, and see how following DDD, CQRS and Event-Sourcing practices will drive our application design and evolution in such a way that we will start with a monolith but we will have the ability to scale into a microservices architecture more or less easily when (and more importantly: if) we need to.
Building modular monoliths that could scale to microservices (only if they ne...David Gómez García
It’s easy these days to fall into the trap of starting to design your whole application with a microservices architecture…. Because, you know, that’s what everyone is doing. Aren't they?
But, are we considering the microservices architecture as a goal or as a means to a purpose?
In this talk, we will go back to the basics and see how DDD, CQRS and EventSourcing practices drive our application design and evolution so that we will start with a monolith. Still, we will have the ability to scale into microservices more or less easily when (and more importantly: if) we need to.
Leveraging Completable Futures to handle your query results AsynchrhonouslyDavid Gómez García
The challenges of developing applications recently have increased. With the popularity of cloud environments, the scalability required by new architectures and the need to support more load efficiently, there has been an increase in attention that we need to pay to concurrency and efficiency.
One strategy to achieve that efficiency consists of distributing the modules of your application in several different smaller components running concurrently. But one of the problems that arise from such distribution of running modules comes when you need to send a request (and wait for the response) to several different modules. How do you design that request(s)-response(s) to be as efficient as possible?
CompletableFutures was introduced with Java 8 but has evolved over the years with every new version of Java released. In this talk, we will take a look at it, to:
understand how to use CompletableFutures,
how they can help us to split our workload into different request and coordinate them asynchronously and concurrently
How you can chain behavior to the responses.
How you can use CompletableFuture in your design to create APIs that enable your users to get the most of your Component/library/module.
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021David Gómez García
It’s easy these days to fall into the trap of starting to design your whole application with a microservices architecture…. Because, you know, that’s what everyone is doing. Aren't they?
But, are we considering the microservices architecture as a goal or as a means to a purpose?
In this talk, we will go back to the basics and see how DDD, CQRS and EventSourcing practices drive our application design and evolution so that we will start with a monolith. Still, we will have the ability to scale into microservices more or less easily when (and more importantly: if) we need to.
These are the slides I used in my talk at JBCNConf 2021.
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationDavid Gómez García
Slides from my talk at Codemotion Milan 2018. Speaking about how Headess and Hypermedia REST APIs can leverage the way . we integrate different platforms and share date between them
Estas son las slides que utilicé en la charla de la reunión de Septiembre de 2014 del GDG de Madrid.
Desde hace tiempo, los desarrolladores venimos utilizando scripts para automatizar y facilitarnos la construcción automática de nuestros proyectos.
En los intentos de estandarización de esos Scripts, la primera herramienta fue Ant, muy flexible, pero muy tediosa por lo verboso y por que siempre había que empezar desde cero.
La llegada de Maven supuso una cierta convención en las tareas y fases de construcción de un proyecto. Pero también incluía una tremenda facilidad para la gestión de librerías y dependencias. A cambio, impone una cierta rigidez en la estructura del script.
Gradle ha venido a buscar lo mejor de los dos mundos: la fexibilidad de Ant, la convención de Maven, la gestión de librerías de Ivy o Mvn.... y todo ello con un lenguaje de scripting más parecido al código que al XML en el que se basan las dos precedesoras.
Desde hace meses, Google ya ha apostado por Gradle como sistema de construcción de proyectos para Android en su Android Studio.
En esta charla, haremos una introducción a Gradle como herramienta de construcción de proyectos.
With code examples from the real world that could give you a stroke.
The slides I used on my talk at t3chFest Madrid 2014.
A talk about Code Quality, Clean Code, and good and bad practices when writing code. A fun walk through the experiences from the real world with some advices and introducing some principles that will help you to write better code.
How to track an Event, trademark, company or subject to know not only how much people is talking about it, but also analizying sentimentally what is being said to know whether people is talking positive or negative.
An example mixing public APIs from Twitter, Google Maps and APICulture.
This is the slides set I used for my talk at Mediterranea APIDays held in Madrid in
The process of creating HDTR images from the photographic shot to the processing via a Photoshop JS script explained.
This is the slide I used for my talk at the monthly MadridJS meeting held on May, 23rd 2013.
Presentación utilizada en el Codemotion 2012 en Madrid.
Integración de un sistema Real utilizando Google Protobuf, Spring, REST, JMS y MongoDB
La experiencia de un proyecto real para control de tráfico marítimo, sus requisitos, las tecnologías que se utilizarón y el porqué de cada una de ellas.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
3. A Stream is…
An convenience method to iterate over
collections in a declarative way
List<Integer> numbers = new ArrayList<Integer>();
for (int i= 0; i < 100 ; i++) {
numbers.add(i);
}
List<Integer> evenNumbers = new ArrayList<>();
for (int i : numbers) {
if (i % 2 == 0) {
evenNumbers.add(i);
}
}
@dgomezg
4. A Stream is…
An convenience method to iterate over
collections in a declarative way
List<Integer> numbers = new ArrayList<Integer>();
for (int i= 0; i < 100 ; i++) {
numbers.add(i);
}
List<Integer> evenNumbers = numbers.stream()
.filter(n -> n % 2 == 0)
.collect(toList());
@dgomezg
5. So… Streams are collections?
Not Really
Collections Streams
Sequence of elements
Computed at construction
In-memory data structure
Sequence of elements
Computed at iteration
Traversable only Once
External Iteration Internal Iteration
Finite size Infinite size
@dgomezg
6. Iterating a Collection
List<Integer> evenNumbers = new ArrayList<>();
for (int i : numbers) {
if (i % 2 == 0) {
evenNumbers.add(i);
}
}
External Iteration
- Use forEach or Iterator
- Very verbose
Parallelism by manually using Threads
- Concurrency is hard to be done right!
- Lots of contention and error-prone
- Thread-safety@dgomezg
7. Iterating a Stream
List<Integer> evenNumbers = numbers.stream()
.filter(n -> n % 2 == 0)
.collect(toList());
Internal Iteration
- No manual Iterators handling
- Concise
- Fluent API: chain sequence processing
Elements computed only when needed
@dgomezg
8. Iterating a Stream
List<Integer> evenNumbers = numbers.parallelStream()
.filter(n -> n % 2 == 0)
.collect(toList());
Easily Parallelism
- Concurrency is hard to be done right!
- Uses ForkJoin
- Process steps should be
- stateless
- independent
@dgomezg
12. Lambda Types
Based on abstract method signature from
@FunctionalInterface:
(Arguments) -> <return type>
@FunctionalInterface
public interface Predicate<T> {
boolean test(T t);
}
T -> boolean
@dgomezg
13. Lambda Types
Based on abstract method signature from
@FunctionalInterface:
(Arguments) -> <return type>
@FunctionalInterface
public interface Runnable {
void run();
}
() -> void
@dgomezg
14. Lambda Types
Based on abstract method signature from
@FunctionalInterface:
(Arguments) -> <return type>
@FunctionalInterface
public interface Supplier<T> {
T get();
}
() -> T
@dgomezg
15. Lambda Types
Based on abstract method signature from
@FunctionalInterface:
(Arguments) -> <return type>
@FunctionalInterface
public interface BiFunction<T, U, R> {
R apply(T t, U t);
}
(T, U) -> R
@dgomezg
16. Lambda Types
Based on abstract method signature from
@FunctionalInterface:
(Arguments) -> <return type>
@FunctionalInterface
public interface Comparator<T> {
int compare(T o1, T o2);
}
(T, T) -> int
@dgomezg
17. Method References
Allows to use a method name as a lambda
Usually better readability
!
Syntax:
<TargetReference>::<MethodName>
!
TargetReference: Instance or Class
@dgomezg
20. Characteristics of A Stream
• Interface to Sequence of elements
• Focused on processing (not on storage)
• Elements computed on demand
(or extracted from source)
• Can be traversed only once
• Internal iteration
• Parallel Support
• Could be Infinite
@dgomezg
21. Anatomy of a Stream
Source
Intermediate
Operations
filter
map
order
function
Final
operation
pipeline
@dgomezg
22. Anatomy of Stream Iteration
1. Start from the DataSource (Usually a
collection) and create the Stream
List<Integer> numbers =
Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
Stream<Integer> numbersStream = numbers.stream();
@dgomezg
23. Anatomy of Stream Iteration
2. Add a chain of intermediate Operations
(Stream Pipeline)
Stream<Integer> numbersStream = numbers.stream()
.filter(new Predicate<Integer>() {
@Override
public boolean test(Integer number) {
return number % 2 == 0;
}
})
!
.map(new Function<Integer, Integer>() {
@Override
public Integer apply(Integer number) {
return number * 2;
}
});
@dgomezg
24. Anatomy of Stream Iteration
2. Add a chain of intermediate Operations
(Stream Pipeline) - Better using lambdas
Stream<Integer> numbersStream = numbers.stream()
.filter(number -> number % 2 == 0)
.map(number -> number * 2);
@dgomezg
25. Anatomy of Stream Iteration
3. Close with a Terminal Operation
List<Integer> numbersStream = numbers.stream()
.filter(number -> number % 2 == 0)
.map(number -> number * 2)
.collect(Collectors.toList());
•The terminal operation triggers Stream Iteration
•Before that, nothing is computed.
•Depending on the terminal operation, the
stream could be fully traversed or not.
@dgomezg
27. Operation Types
Intermediate operations
• Always return a Stream
• Chain as many as needed (Pipeline)
• Guide processing of data
• Does not start processing
• Can be Stateless or Stateful
Terminal operations
• Can return an object, a collection, or void
• Start the pipeline process
• After its execution, the Stream can not be
revisited
28. Intermediate Operations
// T -> boolean
Stream<T> filter(Predicate<? super T> predicate);
!
//T -> R
<R> Stream<R> map(Function<? super T, ? extends R> mapper);
//(T,T) -> int
Stream<T> sorted(Comparator<? super T> comparator);
Stream<T> sorted();
!
//T -> void
Stream<T> peek(Consumer<? super T> action);
!
Stream<T> distinct();
Stream<T> limit(long maxSize);
Stream<T> skip(long n);
@dgomezg
29. Final Operations
Object[] toArray();
void forEach(Consumer<? super T> action); //T -> void
<R, A> R collect(Collector<? super T, A, R> collector);
!
!
java.util.stream.Collectors.toList();
java.util.stream.Collectors.toSet();
java.util.stream.Collectors.toMap();
java.util.stream.Collectors.joining(CharSequence);
!
!
!
@dgomezg
30. Final Operations (II)
//T,U -> R
Optional<T> reduce(BinaryOperator<T> accumulator);
//(T,T) -> int
Optional<T> min(Comparator<? super T> comparator);
//(T,T) -> int
Optional<T> max(Comparator<? super T> comparator);
long count();
!
@dgomezg
31. Final Operations (y III)
//T -> boolean
boolean anyMatch(Predicate<? super T> predicate);
boolean allMatch(Predicate<? super T> predicate);
boolean noneMatch(Predicate<? super T> predicate);
!
@dgomezg
32. Usage examples - Context
public class Contact {
private final String name;
private final String city;
private final String phoneNumber;
private final LocalDate birth;
public int getAge() {
return Period.between(birth, LocalDate.now())
.getYears();
}
//Constructor and getters omitted
!
}
@dgomezg
33. Usage examples - Context
public class PhoneCall {
private final Contact contact;
private final LocalDate time;
private final Duration duration;
!
//Constructor and getters omitted
}
Contact me = new Contact("dgomezg", "Madrid", "555 55 55 55", LocalDate.of(1975, Month.MARCH, 26));
Contact martin = new Contact("Martin", "Santiago", "666 66 66 66", LocalDate.of(1978, Month.JANUARY, 17));
Contact roberto = new Contact("Roberto", "Santiago", "111 11 11 11", LocalDate.of(1973, Month.MAY, 11));
Contact heinz = new Contact("Heinz", "Chania", "444 44 44 44", LocalDate.of(1972, Month.APRIL, 29));
Contact michael = new Contact("michael", "Munich", "222 22 22 22", LocalDate.of(1976, Month.DECEMBER, 8));
List<PhoneCall> phoneCallLog = Arrays.asList(
new PhoneCall(heinz, LocalDate.of(2014, Month.MAY, 28), Duration.ofSeconds(125)),
new PhoneCall(martin, LocalDate.of(2014, Month.MAY, 30), Duration.ofMinutes(5)),
new PhoneCall(roberto, LocalDate.of(2014, Month.MAY, 30), Duration.ofMinutes(12)),
new PhoneCall(michael, LocalDate.of(2014, Month.MAY, 28), Duration.ofMinutes(3)),
new PhoneCall(michael, LocalDate.of(2014, Month.MAY, 29), Duration.ofSeconds(90)),
new PhoneCall(heinz, LocalDate.of(2014, Month.MAY, 30), Duration.ofSeconds(365)),
new PhoneCall(heinz, LocalDate.of(2014, Month.JUNE, 1), Duration.ofMinutes(7)),
new PhoneCall(martin, LocalDate.of(2014, Month.JUNE, 2), Duration.ofSeconds(315))
) ;
@dgomezg
34. People I phoned in June
phoneCallLog.stream()
.filter(phoneCall ->
phoneCall.getTime().getMonth() == Month.JUNE)
.map(phoneCall -> phoneCall.getContact().getName())
.distinct()
.forEach(System.out::println);
!
@dgomezg
35. Seconds I talked in May
Long total = phoneCallLog.stream()
.filter(phoneCall ->
phoneCall.getTime().getMonth() == Month.MAY)
.map(PhoneCall::getDuration)
.collect(summingLong(Duration::getSeconds));
@dgomezg
36. Seconds I talked in May
Optional<Long> total = phoneCallLog.stream()
.filter(phoneCall ->
phoneCall.getTime().getMonth() == Month.MAY)
.map(PhoneCall::getDuration)
.reduce(Duration::plus);
total.ifPresent(duration ->
{System.out.println(duration.getSeconds());}
);
!
@dgomezg
37. Did I phone to Paris?
boolean phonedToParis = phoneCallLog.stream()
.anyMatch(phoneCall ->
"Paris".equals(phoneCall.getContact().getCity()))
!
!
@dgomezg
38. Give me the 3 longest phone calls
phoneCallLog.stream()
.filter(phoneCall ->
phoneCall.getTime().getMonth() == Month.MAY)
.sorted(comparing(PhoneCall::getDuration))
.limit(3)
.forEach(System.out::println);
@dgomezg
39. Give me the 3 shortest ones
phoneCallLog.stream()
.filter(phoneCall ->
phoneCall.getTime().getMonth() == Month.MAY)
.sorted(comparing(PhoneCall::getDuration).reversed())
.limit(3)
.forEach(System.out::println);
@dgomezg
41. Streams can be created from
Collections
Directly from values
Generators (infinite Streams)
Resources (like files)
Stream ranges
@dgomezg
42. From collections
use stream()
List<Integer> numbers = new ArrayList<>();
for (int i= 0; i < 10_000_000 ; i++) {
numbers.add((int)Math.round(Math.random()*100));
}
Stream<Integer> evenNumbers = numbers.stream();
or parallelStream()
Stream<Integer> evenNumbers = numbers.parallelStream();
@dgomezg
43. Directly from Values & ranges
Stream.of("Using", "Stream", "API", "From", “Java8”);
can convert into parallelStream
Stream.of("Using", "Stream", "API", "From", “Java8”)
.parallel();
@dgomezg
44. Generators - Functions
Stream<Integer> integers =
Stream.iterate(0, number -> number + 2);
This is an infinite Stream!,
will never be exhausted!
Stream fibonacci =
Stream.iterate(new int[]{0,1},
t -> new int[]{t[1],t[0]+t[1]});
fibonacci.limit(10)
.map(t -> t[0])
.forEach(System.out::println);
@dgomezg
45. Generators - Functions
Stream<Integer> integers =
Stream.iterate(0, number -> number + 2);
This is an infinite Stream!,
will never be exhausted!
Stream fibonacci =
Stream.iterate(new int[]{0,1},
t -> new int[]{t[1],t[0]+t[1]});
fibonacci.limit(10)
.map(t -> t[0])
.forEach(System.out::println);
@dgomezg
46. From Resources (Files)
Stream<String> fileContent =
Files.lines(Paths.get(“readme.txt”));
Files.lines(Paths.get(“readme.txt”))
.flatMap(line -> Arrays.stream(line.split(" ")))
.distinct()
.count());
!
Count all distinct words in a file
@dgomezg
48. Parallel Streams
use stream()
List<Integer> numbers = new ArrayList<>();
for (int i= 0; i < 10_000_000 ; i++) {
numbers.add((int)Math.round(Math.random()*100));
}
//This will use just a single thread
Stream<Integer> evenNumbers = numbers.stream();
or parallelStream()
//Automatically select the optimum number of threads
Stream<Integer> evenNumbers = numbers.parallelStream();
@dgomezg
49. Let’s test it
use stream()
!
for (int i = 0; i < 100; i++) {
long start = System.currentTimeMillis();
List<Integer> even = numbers.stream()
.filter(n -> n % 2 == 0)
.sorted()
.collect(toList());
System.out.printf(
"%d elements computed in %5d msecs with %d threadsn”,
even.size(), System.currentTimeMillis() - start,
Thread.activeCount());
}
5001983 elements computed in 828 msecs with 2 threads
5001983 elements computed in 843 msecs with 2 threads
5001983 elements computed in 675 msecs with 2 threads
5001983 elements computed in 795 msecs with 2 threads
@dgomezg
50. Let’s test it
use stream()
!
for (int i = 0; i < 100; i++) {
long start = System.currentTimeMillis();
List<Integer> even = numbers.parallelStream()
.filter(n -> n % 2 == 0)
.sorted()
.collect(toList());
System.out.printf(
"%d elements computed in %5d msecs with %d threadsn”,
even.size(), System.currentTimeMillis() - start,
Thread.activeCount());
}
4999299 elements computed in 225 msecs with 9 threads
4999299 elements computed in 230 msecs with 9 threads
4999299 elements computed in 250 msecs with 9 threads
@dgomezg
51. Enough, for now,
But this is just the beginning
Thank You.
@dgomezg
dgomezg@gmail.com
www.adictosaltrabajlo.com