LAMBDA EXPRESSIONS AND STREAMS API
|
|
- Ophelia Chambers
- 6 years ago
- Views:
Transcription
1 Java 8 LAMBDA EXPRESSIONS AND STREAMS API An Introduction
2 Methods As Data 2
3 @FunctionalInterface public interface Runnable { public abstract void run(); public interface ActionListener extends EventListener { public void actionperformed(actionevent e); public interface Comparator<T> { int compare(t o1, T o2); boolean equals(object obj);... Functional Interface Has only one abstract method declared may have other default method declarations may have other static method declarations may have method declarations from Object sometimes known as SAM (Single Abstract Method) interfaces Many Functional Interfaces in API Runnable ActionListener Comparator Can be used as a Target for Lambda Expressions New 3
4 interface Calc { int calculate(int a, int b); public class FunctionalInterfaces { int doescalc (Calc calc) { return calc.calculate(3, public final void testwithanon() { FunctionalInterfaces fi = new FunctionalInterfaces(); int answer = fi.doescalc(new Calc() { public int calculate(int a, int b) { return a + b; ); assertequals(8, answer); 4
5 interface Calc { int calculate(int a, int b); public class FunctionalInterfaces { int doescalc (Calc calc) { return calc.calculate(3, public final void testwithlambda() { FunctionalInterfaces fi = new FunctionalInterfaces(); int answer = fi.doescalc((int x, int y) -> {return x+y;); assertequals(8, answer); 5
6 Syntax Multiple forms (Parameters) -> { statements; or (Parameters) -> expression; Parameter Types may be declared or inferred 6
7 @Test public final void testwithlambda1() { FunctionalInterfaces fi = new FunctionalInterfaces(); int answer = fi.doescalc((int x, int y) -> {return x+y;); assertequals(8, answer); int answer = fi.doescalc((x,y) -> {return x+y;); int answer = fi.doescalc((x,y) -> public final void testwithlambda4() { FunctionalInterfaces fi = new FunctionalInterfaces(); int answer = fi.doescalc((x,y) -> {int a = x*x; int b = y*y; return a+b;); assertequals(34, answer); 7
8 Compile Time Error interface Calc { int calculate(int a, int b); public class FunctionalInterfaces { int doescalc (Calc calc) { return calc.calculate(3, public final void testwithlambda() { FunctionalInterfaces fi = new FunctionalInterfaces(); int answer = fi.doescalc((x,y) -> x.concat(y)); assertequals(8, answer); 8
9 Without Parameters void runthread() { new Thread(() -> System.out.println("with lambdas")).start(); void runthread() { new Thread(new Runnable() public void run() { System.out.println("with anonymous inner class"); ).start(); 9
10 Method References Concrete method of existing class Can reference static or instance methods Both are converted to Lambda Expressions void sortarray() { Integer[] ints = {3,5,7,1; Arrays.sort(ints, Integer::compare); - OR - Arrays.sort(ints, (x,y) -> Integer.compare(x, y)); 10
11 java.util.function Contains Functional Interfaces Used as target types for Lambda Expressions Used extensively by the JDK Basic Shapes Function (takes an argument and produces a result) Consumer (takes an argument and returns void) Predicate (takes and argument and returns boolean) Supplier (takes no argument returns result) arity Modifiers BiConsumer, BiFunction, BiPredicate (take 2 arguments) Primitive Specializations DoubleToIntFunction, LongConsumer, etc. 11
12 BiFunction BiFunction<String, String, String> concat = (s1, s2) -> s1.concat(s2); void mapmerge() { HashMap<String, String> map = new HashMap<>(); map.merge("new_key", "new_value", concat); - OR - map.merge("new_key", "new_value", (s1, s2) -> s1.concat(s2)); - OR - map.merge("new_key", "new_value", String::concat); 12
13 STREAM API Map and Reduce 13
14 STREAM API Streams are sequences of values java.util.stream Stream, IntStream, LongStream, DoubleStream Similar to iterators, but not backed by any particular collection Defines operators which are usually Functional Interfaces Operators manipulate the data as it flows through the stream Intermediate operators are lazy Construct stream pipeline but do not transform any data immediately Terminal operators are eager Causes the entire pipeline to be activated 14
15 STREAM API Intermediate Operators <R> Stream<R> map (Function <T,R> mapper) mapper function will map an element of type T to an element of type R called on a stream of type T, will return a stream of type R Stream<T> filter (Predicate<T> predicate) predicate function will be used to validate each element in called stream returns a new stream of type T with only the filtered elements <R> Stream<R> flatmap (Function<T, Stream<R>> mapper) maps each element of type T to a stream of elements of type R mapped streams are merged and output as a single stream of type R Stream<T> sorted() -or- (Comparator<T> comparator) each element is sorted by either their own compareto, or the given comparator stateful operator, needs to wait for all data from any upstream operators 15
16 STREAM API Terminal Operators void foreach (Consumer<T> consumer) each element in the stream will be processed by the consumer function <R> R collect (Collector<T,R> collector) collects all elements of the stream into a resultant collection Collectors class has many options for results - Collectors.toList - Collectors.toCollection(TreeSet::new) - Collectors.summingInt(p -> p.amount) Iterator<T> () returns an Iterator that can be used to further manipulate the stream outputs 16
17 STREAM API Short-Circuit Operators Intermediate Stream<T> limit (long) returns specified number of elements from stream as a new stream Terminal boolean allmatch (Predicate<T> predicate) will short-circuit if any element fails predicate test boolean anymatch (Predicate<T> predicate) will short-circuit as soon as a match is found boolean nonematch(predicate<t> predicate will short-circuit as soon as a match is found 17
18 STREAM API class Restaurant { int rating() { return rating; List<Restaurant> getgoodrestaurants(list<restaurant> list) { ArrayList<Restaurant> good = new ArrayList<Restaurant>(); for (Restaurant restaurant : list) { if (restaurant.rating() > 3) { good.add(restaurant); return good; - with Stream API - List<Restaurant> getgoodrestaurants2(list<restaurant> list) { return list.stream().filter(r -> r.rating() > 3).collect(Collectors.toList()); 18
19 STREAM API Concurrency Streams are executed in sequence by default Internal iteration allows for other execution strategies Use of a ParallelStream allows execution over multiple cores The parallelstream() method will return a stream ready for concurrency All future operators will be handled in parallel The stream will be split into multiple substreams Substreams will be operated on in parallel and results will be combined. Watch out for side effects 19
20 STREAM API List<Restaurant> getgoodrestaurants2(list<restaurant> list) { return list.stream().filter(r -> r.rating() > 3).collect(Collectors.toList()); - becomes - List<Restaurant> getgoodrestaurants2(list<restaurant> list) { return list.parallelstream().filter(r -> r.rating() > 3).collect(Collectors.toList()); 20
21 THANK YOU any questions?
New Features in Java 8
New Features in Java 8 Lambda expressions Functional interfaces Streaming support for Collections Lambda expressions Are a block of java code with parameters Can be assigned to variables Can be executed
More informationJava 8 new features Juan Hernández
Java 8 new features Juan Hernández Dec 1st 2015 1 / 73 Introduction In this session we will do an introduction to the new features introduced by Java 8 for functional programming: λ-expressions and the
More informationFunctional Constructs in Java 8: Lambdas and Streams
Functional Constructs in Java 8: Lambdas and Streams Josh Bloch Charlie Garrod School of Computer Science 1 Administrivia Homework 6 due Thursday 11:59 pm Final exam Tuesday, May 3, 5:30-8:30 pm, PH 100
More informationJava SE 8: Lambda Expressions And The Stream API
Java SE 8: Lambda Expressions And The Stream API Simon Ritter Head of Java Technology Evangelism Java Product Management Java Day Tokyo 2015 April 8, 2015 Safe Harbor Statement The following is intended
More informationLambdas & Streams In JDK 8: Beyond The Basics
Lambdas & Streams In JDK 8: Beyond The Basics Simon Ritter Deputy CTO, Azul Systems @speakjava azul.com Copyright Azul Systems 2015 1 A clever man learns from his mistakes......a wise man learns from other
More informationPIC 20A Anonymous classes, Lambda Expressions, and Functional Programming
PIC 20A Anonymous classes, Lambda Expressions, and Functional Programming Ernest Ryu UCLA Mathematics Last edited: December 8, 2017 Introductory example When you write an ActionListener for a GUI, you
More informationJava Technologies. Lecture V. Valdas Rapševičius
Preparation of the material was supported by the project Increasing Internationality in Study Programs of the Department of Computer Science II, project number VP1 2.2 ŠMM-07-K-02-070, funded by The European
More informationJava SE 8 Programming
Oracle University Contact Us: +52 1 55 8525 3225 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features and Application Programming
More informationOverview of Java 8 Functional Interfaces
Overview of Java 8 Functional Interfaces Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University
More informationCollections After Eight. Maurice Naftalin Morningside Light
Collections After Eight Maurice Naftalin Morningside Light Ltd. @mauricenaftalin Maurice Naftalin Developer, designer, architect, teacher, learner, writer Co-author www.lambdafaq.org Current Projects Why
More informationJava SE 8 Programming
Java SE 8 Programming Training Calendar Date Training Time Location 16 September 2019 5 Days Bilginç IT Academy 28 October 2019 5 Days Bilginç IT Academy Training Details Training Time : 5 Days Capacity
More informationJava SE 8 Programming
Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features
More informationJava 8 Functional Programming with Lambdas Angelika Langer
Java 8 Functional Programming with Lambdas Angelika Langer Training/Consulting objective learn about lambda expressions in Java know the syntax elements understand typical uses Lambda Expressions in Java
More informationFree your Lambdas Java SE 8
Free your Lambdas Java SE 8 Agenda Tutorial session: we will start at the very beginning! and explore how to build functional interfaces to design new APIs This is about lambdas and functional interfaces
More informationPrinciples of Programming Languages
Principles of Programming Languages h"p://www.di.unipi.it/~andrea/dida2ca/plp- 15/ Prof. Andrea Corradini Department of Computer Science, Pisa Lesson 30 Java 8! Lambdas and streams in Java 8 1 Java 8:
More informationMulticore Programming
Multicore Programming Java Streams Louis-Claude Canon louis-claude.canon@univ-fcomte.fr Bureau 414C Master 1 informatique Semestre 8 Louis-Claude Canon MCP Java Streams 1 / 124 Motivations Express simple
More informationLambda Expressions and Java 8 Streams. Jan Trienes, adapted by Th. Dorssers, Pieter van den Hombergh. Contents of this talk.
Java 8 s and Java 8 van den Hombergh Fontys Hogeschool voor Techniek en Logistiek February 23, 2017 and /FHTenL s and Java 8 February 23, 2017 1/28 talk Expression and Internal/External Iteration Java
More informationJava8: Stream Style. Sergey
Java8: Stream Style Sergey Kuksenko sergey.kuksenko@oracle.com, @kuksenk0 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be
More informationAdvanced Programming Methods. Lecture 4 - Functional Programming in Java
Advanced Programming Methods Lecture 4 - Functional Programming in Java Important Announcement: At Seminar 6 (7-13 November 2017) you will have a closed-book test (based on your laboratory work). Overview
More informationFontys Hogeschool voor Techniek en Logistiek. March 13, 2018
Java 8 s and Java 8 Fontys Hogeschool voor Techniek en Logistiek March 13, 2018 and? /FHTenL s and Java 8 March 13, 2018 1/34 talk The other anonymous and? Java 8 and? /FHTenL s and Java 8 March 13, 2018
More informationStreams in Java 8. Start programming in a more functional style
Streams in Java 8 Start programming in a more functional style Background Who am I? Tobias Coetzee I m a Technical Lead at BBD I present the Java Expert Level Certifications at BBD (EJB, JPA, etc.) I m
More informationJava Technologies. Lecture IV. Valdas Rapševičius
Preparation of the material was supported by the project Increasing Internationality in Study Programs of the Department of Computer Science II, project number VP1 2.2 ŠMM-07-K-02-070, funded by The European
More informationPeter Sestoft. Java Precisely. Third Edition. The MIT Press Cambridge, Massachusetts London, England
Peter Sestoft Java Precisely Third Edition The MIT Press Cambridge, Massachusetts London, England Contents Preface Notational Conventions xi xii 1 Running Java: Compilation, Loading, and Execution 2 2
More informationJava SE 8 New Features
Java SE 8 New Features Duration 2 Days What you will learn This Java SE 8 New Features training delves into the major changes and enhancements in Oracle Java SE 8. You'll focus on developing an understanding
More informationCOURSE 5 PROGRAMMING III OOP. JAVA LANGUAGE
COURSE 5 PROGRAMMING III OOP. JAVA LANGUAGE PREVIOUS COURSE CONTENT Generics Defining a generic Run-time behavior Collections List Set Map COUSE CONTENT Collections Utilities classes Aggregate Operations
More informationBinghamton University. CS-140 Fall Functional Java
Functional Java 1 First Class Data We have learned how to manipulate data with programs We can pass data to methods via arguments We can return data from methods via return types We can encapsulate data
More informationQuick start. Robert Bachmann & Dominik Dorn. JSUG Meeting #63
1.. Java 8 Quick start Robert Bachmann & Dominik Dorn JSUG Meeting #63 Outline: What s new in Java 8 2 Interface additions and lambda syntax (r) Library additions (r) Nashorn (d) Type annotations (d) VM
More informationHigher-Order Sequential Operations
Chapter 9 Higher-Order Sequential Operations Many of the operations we wish to perform over lists have common structure. In this chapter, we investigate the most common of these patterns and how we can
More informationLambdas in Java 8. Start programming in a more functional style
Lambdas in Java 8 Start programming in a more functional style Background Who am I? Tobias Coetzee I m a Technical Lead at BBD I present the Java Expert Level Certifications at BBD (EJB, JPA, etc.) I m
More informationΠΙΝΑΚΑΣ ΠΛΑΝΟΥ ΕΚΠΑΙΔΕΥΣΗΣ
ΠΑΡΑΡΤΗΜΑ «Β» ΠΙΝΑΚΑΣ ΠΛΑΝΟΥ ΕΚΠΑΙΔΕΥΣΗΣ Α/Α ΠΕΡΙΓΡΑΦΗ ΕΚΠΑΙΔΕΥΣΗΣ ΘΕΜΑΤΙΚΕΣ ΕΝΟΤΗΤΕΣ 1. Java SE8 Fundamentals What Is a Java Program? Introduction to Computer Programs Key Features of the Java Language
More informationCADEC JAVA 8 MAGNUS LARSSON CALLISTAENTERPRISE.SE
CADEC 2015 - JAVA 8 MAGNUS LARSSON 2015.01.28 CALLISTAENTERPRISE.SE 1 JAVA 8 NEW FEATURES Overview Lambda Expressions Stream API 2 JAVA 8 NEW FEATURES - OVERVIEW New Date/Time API - Based on Joda-Time
More informationStreams and Pipelines
Streams 1 / 12 Streams and Pipelines A stream is a sequence of elements. Unlike a collection, it is not a data structure that stores elements. Unlike an iterator, streams do not allow modification of the
More informationJava 8 Functional Programming with Lambdas Angelika Langer
Java 8 Functional Programming with Lambdas Angelika Langer Training/Consulting objective learn about lambda expressions in Java know the syntax elements understand typical uses Lambda Expressions in Java
More informationCollections After Eight. Maurice Naftalin Morningside Light
Collections After Eight Maurice Naftalin Morningside Light Ltd. @mauricenaftalin Maurice Naftalin Developer, designer, architect, teacher, learner, writer 3 Maurice Naftalin Developer, designer, architect,
More informationLAMBDA EXPRESSIONS. Summer 2018
LAMBDA EXPRESSIONS Summer 2018 LAMBDA EXPRESSIONS USES Introduced in Java SE 8, lambda expressions are a way to create single-method classes in your code in a much less cumbersome manner than anonymous
More informationLambdas, Default Methods and Bulk Data Operations by Anton Arhipov. All rights reserved ZeroTurnaround OÜ
Java 8 Revealed Lambdas, Default Methods and Bulk Data Operations by Anton Arhipov 1 Table of contents Introduction to Java 8 1-2 Part I Lambdas in Java 8 3-10 Part Ii Default Methods 12-15 Part iii Bulk
More informationJava (8) for C++ Programmers
Java (8) for C++ Programmers Technion - Israel Institute of Technology Oren Afek, Natan Bagrov - March 2017 236703 - Object-Oriented Programming 1 Why Java? Object-oriented (even though not purely ) Portable
More informationPerchance to Stream with Java 8
Perchance to Stream with Java 8 Paul Sandoz Oracle The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated $$ into
More informationAdvanced Java Programming
Advanced Java Programming Programming Technologies 2015/2016 spring Kollár, Lajos Kocsis, Gergely (English version) Advanced Java Programming Java 5 Generics (Enums) Java 7 Strings in switch try-with-resources
More informationLambda Notes for CS 2102
Lambda Notes for CS 2102 Remember filter and map from CS1101/1102: ;; filter: (X- >Boolean) ListOfX - > ListOfX the function argument (X- > Boolean) is a predicate. Filter applies the predicate to each
More informationLambda Expressions In JDK8: Going Beyond The Basics
Lambda Expressions In JDK8: Going Beyond The Basics Simon Ri?er Head of Java Technology Evangelism Oracle Corp Twi?er: @speakjava Copyright 2014, Oracle and/or its affiliates. All rights reserved. Safe Harbor
More informationNotable Enhancements in Java 8. Functional Programming with Java. Lambda Expressions in Java. How to Define a Lambda Expression? Lambda expressions
Notable Enhancements in Java 8 Lambda expressions Allow you to do functional programming in Java Functional Programming with Java Static and default methods in interfaces 1 2 Lambda Expressions in Java
More information<Insert Picture Here> Project Lambda: To Multicore and Beyond
Project Lambda: To Multicore and Beyond Brian Goetz Java Language Architect, Oracle Corporation The following is intended to outline our general product direction. It is intended
More informationCommon mistakes made with Functional Java. Brian Vermeer
Common mistakes made with Functional Java Brian Vermeer (@BrianVerm) Brian Vermeer Software Engineer Doing too much in a single lambda @BrianVerm Lambda Expression In computer programming, a lambda
More information301AA - Advanced Programming [AP-2017]
301AA - Advanced Programming [AP-2017] Lecturer: Andrea Corradini andrea@di.unipi.it Tutor: Lillo GalleBa galleba@di.unipi.it Department of Computer Science, Pisa Academic Year 2017/18 AP-2017-15: Recursion,
More informationProject Lambda: Functional Programming Constructs and Simpler Concurrency in Java SE 8
Project Lambda: Functional Programming Constructs and Simpler Concurrency in Java SE 8 Michael Cui Principle Engineer, Java Platform Group Oracle Corporation 1 The following is intended to outline our
More information301AA - Advanced Programming
301AA - Advanced Programming Lecturer: Andrea Corradini andrea@di.unipi.it h;p://pages.di.unipi.it/corradini/ Course pages: h;p://pages.di.unipi.it/corradini/dida@ca/ap-18/ AP-2018-23: Streams in Java
More informationIntroduction to Functional Programming in Java 8
1 Introduction to Functional Programming in Java 8 Java 8 is the current version of Java that was released in March, 2014. While there are many new features in Java 8, the core addition is functional programming
More informationIntroducing Scala-like function types into Java-TX
Introducing Scala-like function types into Java-TX ManLang 2017 Martin Plümicke Andreas Stadelmeier www.dhbw-stuttgart.de/horb Overview 1 Type of lambda expressions in Java-8 2 Introducing real function
More informationBinghamton University. CS-140 Fall Functional Java
Functional Java 1 First Class Data We have learned how to manipulate data with programs We can pass data to methods via arguments We can return data from methods via return types We can encapsulate data
More informationLambdas & Streams: Taking the Hard Work Out of Bulk Operations in Java SE 8.
Lambdas & Streams: Taking the Hard Work Out of Bulk Operations in Java SE 8 Simon Ritter Head of Java Evangelism Oracle Corporation Twitter: @speakjava 1 Concurrency in Java Project Lambda java.util.concurrent
More informationINSTRUCTIONS TO CANDIDATES
NATIONAL UNIVERSITY OF SINGAPORE SCHOOL OF COMPUTING FINAL ASSESSMENT FOR Semester 1 AY2017/2018 CS2030 Programming Methodology II November 2017 Time Allowed 2 Hours INSTRUCTIONS TO CANDIDATES 1. This
More informationCopyright 2012, Oracle and/or its affiliates. All rights reserved.
1 Jump-Starting Lambda Stuart Marks @stuartmarks Mike Duigou @mjduigou Oracle JDK Core Libraries Team 2 What is Lambda? Essentially an anonymous function allows one to treat code as data provides parameterization
More informationJosh Bloch Charlie Garrod Darya Melicher
Principles of Software Construction: Objects, Design, and Concurrency Lambdas and streams Josh Bloch Charlie Garrod Darya Melicher 1 Administrivia Homework 5 Best Frameworks available tonight Or early
More informationCopyright 2014, Oracle and/or its affiliates. All rights reserved.
1 Introduction to Lambda Stuart W. Marks Principal Member of Technical Staff Oracle JDK Core Libraries Team Twitter: @stuartmarks What is a Lambda? A lambda is a function. A function is a computation that
More informationOutline. Command Pattern. Examples. Goal & Applications Motivation (undo / redo) Structure & participants Sequence diagram
Outline Command Pattern Goal & Applications Motivation (undo / redo) Structure & participants Sequence diagram Examples javax.swing.action java.util.timer java.util.concurrent.executorservice Callable
More informationAdvanced programming for Java platform. Introduction
Advanced programming for Java platform Introduction About course Petr Hnětynka hnetynka@d3s.mff.cuni.cz http://d3s.mff.cuni.cz/teaching/vsjava/ continuation of "Java (NPRG013)" basic knowledge of Java
More informationJava 8 Programming for OO Experienced Developers
www.peaklearningllc.com Java 8 Programming for OO Experienced Developers (5 Days) This course is geared for developers who have prior working knowledge of object-oriented programming languages such as
More informationJava Collection Framework
Java Collection Framework Readings Purpose To provide a working knowledge of the Java Collections framework and iterators. Learning Objectives Understand the structure of the Java Collections framework
More informationJava 8 Lambdas & Streams Angelika Langer
Java 8 Lambdas & Streams Angelika Langer objective understand lambda expressions learn about method references explore the stream API get a feeling for its performance model Lambdas & Streams in Java 8
More informationCOMP6700/2140 Code as Data
COMP6700/2140 Code as Data Alexei B Khorev Research School of Computer Science, ANU March 2017 Alexei B Khorev (RSCS, ANU) COMP6700/2140 Code as Data March 2017 1 / 19 Topics 1 What does treating code
More informationEclipse and Java 8. Daniel Megert Platform and JDT Lead Eclipse PMC Member IBM Rational Zurich Research Lab
Eclipse and Java 8 Daniel Megert Platform and JDT Lead Eclipse PMC Member IBM Rational Zurich Research Lab Eclipse and Java 8 New Java language features Eclipse features for Java 8 (demo) Behind the scenes
More informationCSC 207 (16fa) Practice Exam 2 Page 1 of 13. Practice Exam 2 (Exam 2 date: Friday 11/18) Logistics:
CSC 207 (16fa) Practice Exam 2 Page 1 of 13 Practice Exam 2 (Exam 2 date: Friday 11/18) Logistics: In-class, written exam. Closed-book, notes, and technology. All relevant Java API documentation will be
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationProject Lambda in Java SE 8
Project Lambda in Java SE 8 Daniel Smith Java Language Designer 1 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated
More informationJAVA. java.lang.stringbuffer java.lang.stringbuilder
JAVA java.lang.stringbuffer java.lang.stringbuilder 1 Overview mutable string instances of String are immutable do not extend String String, StringBuffer, StringBuilder are final StringBuffer safe for
More informationAusblick auf Java 8. Martin Plümicke. 25. Mai Baden-Wuerttemberg Cooperative State University Stuttgart/Horb
Ausblick auf Java 8 Martin Plümicke Baden-Wuerttemberg Cooperative State University Stuttgart/Horb 25. Mai 2012 Overview Introduction Introduction Closures Java s motivation λ expressions Functional interfaces
More informationFast Track to Core Java 8 Programming for OO Developers (TT2101-J8) Day(s): 3. Course Code: GK1965. Overview
Fast Track to Core Java 8 Programming for OO Developers (TT2101-J8) Day(s): 3 Course Code: GK1965 Overview Java 8 Essentials for OO Developers is a three-day, fast-paced, quick start to Java 8 training
More informationIntroduction to Object-Oriented Programming
Introduction to Object-Oriented Programming Lambda Expressions Christopher Simpkins chris.simpkins@gatech.edu CS 1331 (Georgia Tech) Lambda Expressions 1 / 14 Inner Classes Recall from SortTroopers.java
More informationEvolving Java. Brian Goetz Java Language Architect, Oracle. Copyright 2013, Oracle and/or its affiliates. All rights reserved.
Evolving Java Brian Goetz Java Language Architect, Oracle 1 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated
More informationJava9 - Features abseits von Jigsaw und JShell. BED-Con September 2017
Java9 - Features abseits von Jigsaw und JShell BED-Con 2017 22. September 2017 Michael Vitz Senior Consultant @ innoq michael.vitz@innoq.com @michaelvitz Zeitplan Features JEP 102 Process API Updates
More informationAbstract. 1. What is an ABSTRACT METHOD? 2. Why you would want to declare a method as abstract? 3. A non-abstract CLASS is called a concrete class
ABSTRACT 2 1. What is an ABSTRACT METHOD? 2 2. Why you would want to declare a method as abstract? 2 3. A non-abstract CLASS is called a concrete class 2 4. Abstract Example 2 5. If you are extending ABSTRACT
More informationLambdas, streams, and functional-style programming IN ACTION. Raoul-Gabriel Urma Mario Fusco Alan Mycroft S AMPLE CHAPTER MANNING
Lambdas, streams, and functional-style programming IN ACTION Raoul-Gabriel Urma Mario Fusco Alan Mycroft S AMPLE CHAPTER MANNING Java 8 in Action by Raoul-Gabriel Urma Mario Fusco Alan Mycroft Chapter
More informationJAVA WRAPPER CLASSES
JAVA WRAPPER CLASSES Description Each of Java's eight primitive data types has a class dedicated to it. These are known as wrapper classes, because they "wrap" the primitive data type into an object of
More informationFunctional Java Lambda Expressions
Functional Java Lambda Expressions 1 Functions as a First Class Citizen If there was just some way of packaging the compare function And then passing that function as an argument to sort Then we wouldn
More informationWhether to Include Java 8 Features in Introductory CS Courses
CCSC Eastern Conference 2015 Tutorial Whether to Include Java 8 Features in Introductory CS Courses James Heliotis Computer Science Rochester Inst. of Technology jeh@cs.rit.edu 1 Our History in Java Education
More informationMIT AITI Lecture 18 Collections - Part 1
MIT AITI 2004 - Lecture 18 Collections - Part 1 Collections API The package java.util is often called the "Collections API" Extremely useful classes that you must understand to be a competent Java programmer
More informationUsing Lambdas to Write Mixins in Java 8
Using Lambdas to Write Mixins in Java 8 Dr Heinz M. Kabutz heinz@javaspecialists.eu Last updated 2014-11-12 2014 Heinz Kabutz All Rights Reserved Copyright Notice l 2014 Heinz Kabutz, All Rights Reserved
More informationJava Workshop Lambda Expressions
Java Workshop Lambda Expressions AP Java Workshop 2015 Hanno Hüther and Martin Stein Agenda 1. Origin and syntax 2. History and motivation 3. Exercise 1: Refactoring to lambdas 4. Method references 5.
More informationIntroduction to Object-Oriented Programming
Introduction to Object-Oriented Programming Iterators and Streams Christopher Simpkins chris.simpkins@gatech.edu CS 1331 (Georgia Tech) Iterators and Streams 1 / 20 The Collections Framework A collection
More informationJAVA. java.lang.stringbuffer java.lang.stringbuilder
JAVA java.lang.stringbuffer java.lang.stringbuilder 1 Overview mutable string instances of String are immutable do not extend String String, StringBuffer, StringBuilder are final StringBuffer safe for
More informationJava SE 8 Overview. Simon Ritter Head of Java Technology Evangelism.
Java SE 8 Overview Simon Ritter Head of Java Technology Evangelism Twitter: @speakjava Java SE 8 (JSR 337) Component JSRs New functionality JSR 308: Annotations on types JSR 310: Date and Time API JSR
More informationDomain-Driven Design Activity
Domain-Driven Design Activity SWEN-261 Introduction to Software Engineering Department of Software Engineering Rochester Institute of Technology Entities and Value Objects are special types of objects
More informationPieter van den Hombergh Thijs Dorssers Stefan Sobek. June 8, 2017
Pieter van den Hombergh Thijs Dorssers Stefan Sobek Fontys Hogeschool voor Techniek en Logistiek June 8, 2017 /FHTenL June 8, 2017 1/19 Collection Zoo The basic collections, well known in programming s
More informationMurach s Beginning Java with Eclipse
Murach s Beginning Java with Eclipse Introduction xv Section 1 Get started right Chapter 1 An introduction to Java programming 3 Chapter 2 How to start writing Java code 33 Chapter 3 How to use classes
More informationLambda expressions in Java: a compiler writer's perspective. Maurizio Cimadamore Type-system engineer, Oracle Corporation
Lambda expressions in Java: a compiler writer's perspective Maurizio Cimadamore Type-system engineer, Oracle Corporation The following is intended to outline our general product direction. It is intended
More informationFunctional Programming in Java Part 2. CSE 219 Department of Computer Science, Stony Brook University
Functional Programming in Java Part 2 CSE 219, Stony Brook University Functions as Objects The interface java.util.function.function To store a function (i.e., take a single argument and returns a
More information1z0-813.exam.28q 1z0-813 Upgrade to Java SE 8 OCP (Java SE 6 and all prior versions)
1z0-813.exam.28q Number: 1z0-813 Passing Score: 800 Time Limit: 120 min 1z0-813 Upgrade to Java SE 8 OCP (Java SE 6 and all prior versions) Exam A QUESTION 1 Given the code fragment: What is the result?
More information5/23/2015. Core Java Syllabus. VikRam ShaRma
5/23/2015 Core Java Syllabus VikRam ShaRma Basic Concepts of Core Java 1 Introduction to Java 1.1 Need of java i.e. History 1.2 What is java? 1.3 Java Buzzwords 1.4 JDK JRE JVM JIT - Java Compiler 1.5
More informationCOMP 250. Lecture 32. interfaces. (Comparable, Iterable & Iterator) Nov. 22/23, 2017
COMP 250 Lecture 32 interfaces (Comparable, Iterable & Iterator) Nov. 22/23, 2017 1 Java Comparable interface Suppose you want to define an ordering on objects of some class. Sorted lists, binary search
More information(2½ hours) Total Marks: 75
(2½ hours) Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Makesuitable assumptions wherever necessary and state the assumptions mad (3) Answers to the same question must be written together.
More informationCharlie Garrod Michael Hilton
Principles of So3ware Construc9on: Objects, Design, and Concurrency Part 6: Et cetera Java lambdas and streams Charlie Garrod Michael Hilton School of Computer Science 1 Administrivia Homework 5 Best Frameworks
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Copyright 1992-2015 by Pearson Education, Inc. All Rights Reserved. Data structures Collections of related data items. Discussed in depth in Chapters 16 21. Array objects Data
More informationCollections, Maps and Generics
Collections API Collections, Maps and Generics You've already used ArrayList for exercises from the previous semester, but ArrayList is just one part of much larger Collections API that Java provides.
More informationCollections Algorithms
Collections Algorithms 1 / 11 The Collections Framework A collection is an object that represents a group of objects. The collections framework allows different kinds of collections to be dealt with in
More informationContents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix
PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring
More informationDOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS
Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully
More informationM257 Past Paper Oct 2008 Attempted Solution
M257 Past Paper Oct 2008 Attempted Solution Part 1 Question 1 A version of Java is a particular release of the language, which may be succeeded by subsequent updated versions at a later time. Some examples
More informationApplication Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started
Application Development in JAVA Duration Lecture: Specialization x Hours Core Java (J2SE) & Advance Java (J2EE) Detailed Module Part I: Core Java (J2SE) Getting Started What is Java all about? Features
More information