Lambdas & Streams Laboratory

Slides:



Advertisements
Similar presentations
Using Microsoft PowerPoint in the Classroom
Advertisements

Chapter 3 Reusing a Presentation and Adding Media and Animation
Copyright 2007, Paradigm Publishing Inc. POWERPOINT 2007 CHAPTER 2 BACKNEXTEND 2-1 LINKS TO OBJECTIVES Check Spelling Insert, Delete, Find and Replace.
COMPREHENSIVE PowerPoint Tutorial 3 Adding Special Effects to a Presentation.
Chapter 2 Enhancing a Presentation with Pictures, Shapes, and WordArt
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft PowerPoint 2002 Creating a Custom.
Learning Microsoft Power Point Getting Started  There are three features that you should remember as you work within PowerPoint 2007: the Microsoft.
Lambdas and Streams. Functional interfaces Functional interfaces are also known as single abstract method (SAM) interfaces. Package java.util.function.
PowerPoint 1 The Basics 1. Save this file to your Apps Folder as YourLastName_PP1 2. Read each slide. 3. Complete each set of numbered directions.
® Microsoft PowerPoint 2010 ® Tutorial 3 Adding Special Effects to a Presentation.
Welcome to PowerPoint for Beginners In-Tech Training Elementary School Teachers Day 2 January 13 and 14, 2003.
Please NOTE… Migrating content from previous.ppt presentations may cause issues with the master slides, fonts and positions will alter, therefore we recommend;
1.Click on “Start” menu 2.Click on “ 1. Choose a different layout for your slide.
1 Getting Started The following slides outline the steps to planning and creating your PowerPoint slide show presentation.
OBJECTIVES Identify options for creating a new presentation Learn how to organize and display information visually Design a presentation using PowerPoint.
Enhancing a Presentation with Pictures, Shapes, and WordArt
Functional Processing of Collections (Advanced) 6.0.
Enterprise Communications
Computer Fundamentals 1
Welcome: Hands-On Lab Plug in to the network.
This is a Safe Harbor Front slide, one of two Safe Harbor Statement slides included in this template. One of the Safe Harbor slides must be used if your.
Instructions – please delete
This is a Safe Harbor Front slide, one of two Safe Harbor Statement slides included in this template. One of the Safe Harbor slides must be used if your.
New Oracle Database Release Model
Oracle JavaOne 2017 – Hands-On Labs (HOL) Get Started on Oracle Cloud: Java Apps with Containers and DevOps Plug in to the network Connect via WiFi. Connect.
Using this Template Converting an old presentation to the new template: Step 1: Launch the new DESTACO PowerPoint template. Click the “view" tab and choose.
Oracle and CERN openlab
Functional Processing of Collections (Advanced)
Shelly Cashman: Microsoft PowerPoint 2016
exploring Microsoft Office 2013 Plus
Chapter II Creating Your First PowerPoint Presentation
BlackJack Hands-on-lab
CMS to G1 - Java GC Vaibhav Choudhary Java Platforms Team
Solutions – Oracle’s Story
Instructions – please delete
Instructions – please delete
Instructions – please delete
Instructions – please delete
Objectives To examine the different types of slide layouts.
Instructions – please delete
Oracle ZFS Storage Backup Appliance
Instructions – please delete
Lambda Expressions.
Instructions – please delete
Instructions – please delete
Instructions – please delete
To insert this slide into your presentation
Click to edit title TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing.
To insert this slide into your presentation
EVENT TITLE Time, Date Location
To insert this slide into your presentation
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
EVENT TITLE Time, Date Location
Instructions – please delete
Instructions – please delete
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
Click to edit title TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing.
Instructions – please delete
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
Click to edit title TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing.
Managing CPQ Performance Proactively
To insert this slide into your presentation
To insert this slide into your presentation
Microsoft PowerPoint 2016 Tips & Tricks Rich Malloy, Tech Help Today
Faded background picture (Basic)
To insert this slide into your presentation
To insert this slide into your presentation
To insert this slide into your presentation
Presentation transcript:

Lambdas & Streams Laboratory Stuart Marks Simon Ritter Angela Caicedo Oracle Corp. This is a Title Slide with Java FY15 Theme slide ideal for including the Java Theme with a brief title, subtitle and presenter information. To customize this slide with your own picture: Right-click the slide area and choose Format Background from the pop-up menu. From the Fill menu, click Picture and texture fill. Under Insert from: click File. Locate your new picture and click Insert. To copy the Customized Background from Another Presentation on PC Click New Slide from the Home tab's Slides group and select Reuse Slides. Click Browse in the Reuse Slides panel and select Browse Files. Double-click the PowerPoint presentation that contains the background you wish to copy. Check Keep Source Formatting and click the slide that contains the background you want. Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Right-click any selected slide, point to Layout, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates. To copy the Customized Background from Another Presentation on Mac Click New Slide from the Home tab's Slides group and select Insert Slides from Other Presentation… Navigate to the PowerPoint presentation file that contains the background you wish to copy. Double-click or press Insert. This prompts the Slide Finder dialogue box. Make sure Keep design of original slides is unchecked and click the slide(s) that contains the background you want. Hold Shift key to select multiple slides. Apply New Layout (Important): Click Layout from the Home tab's Slides group, and click the slide containing the desired layout from the layout gallery. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Lambdas and Functions Library Review

Lambda Expressions Lambda expression is an anonymous function Think of it like a method But not associated with a class Can be used wherever you would use an anonymous inner class Single abstract method type Syntax ([optional-parameters]) -> body Types can be inferred (parameters and return type)

Lambda Examples SomeList<Student> students = ... double highestScore = students.stream(). filter(Student s -> s.getGradYear() == 2011). map(Student s -> s.getScore()). max(); Question: how are we going to get there with real collections?

Method References Method references let us reuse a method as a lambda expression FileFilter x = new FileFilter() { public boolean accept(File f) { return f.canRead(); } }; FileFilter x = (File f) -> f.canRead(); FileFilter x = File::canRead;

The Stream Class java.util.stream Stream<T> A sequence of elements supporting sequential and parallel operations A Stream is opened by calling: Collection.stream() Collection.parallelStream() Many Stream methods return Stream objects Very simple (and logical) method chaining

Stream Basics Using a Stream means having three things A source Something that creates a Stream of objects Zero or more intermediate objects Take a Stream as input, produce a Stream as output Potentially modify the contents of the Stream (but don’t have to) A terminal operation Takes a Stream as input Consumes the Stream, or generates some other type of output

Stream Usage Multiple operations available collect, filter, count, skip, limit, sorted map (and map to types, e.g. mapToInt) flatMap maps each element in a Stream to possibly multiple elements e.g. flatMap(line -> Stream.of(line.split(REGEXP)); List<String> names = Arrays.asList(“Bob”, “Alice”, “Charlie”); System.out.println(names. stream(). filter(e -> e.getLength() > 4). findFirst(). get());

java.util.function Package Predicate<T> Determine if the input of type T matches some criteria Consumer<T> Accept a single input argumentof type T, and return no result Function<T, R> Apply a function to the input type T, generating a result of type R Plus several more

The iterable Interface Used by most collections One method forEach() The parameter is a Consumer wordList.forEach(s -> System.out.println(s)); wordList.forEach(System.out::println);

Files and Lines of Text BufferedReader has new method Stream<String> lines() HINT: Test framework creates a BufferedReader for you

Maps and FlatMaps Map FlatMap Map Values in a Stream 1 to 1 mapping Input Stream Output Stream Map 1 to many mapping Input Stream Output Stream FlatMap

Useful Stream Methods collect (terminal) filter (intermediate) count (terminal) skip, limit (intermediate) max (terminal) getAsInt (terminal)

Getting Started Open the LambdasHOL project in NetBeans The exercises are configured as tests Edit the tests Remove the @Ignore annotation Run the tests (Ctrl F6, or from the menu) Make the tests pass Simple!

Let’s Go!