Showing posts with label Java 8. Show all posts
Showing posts with label Java 8. Show all posts

Friday, March 25, 2016

Mastering Concurrency Programming with Java 8

Master the principles and techniques of multithreaded programming with the Java 8 Concurrency API

Mastering Concurrency Programming with Java 8

About This Book
  • Implement concurrent applications using the Java 8 Concurrency API and its new components
  • Improve the performance of your applications or process more data at the same time, taking advantage of all of your resources.
  • Construct real-world examples related to machine learning, data mining, image processing, and client/server environments
Who This Book Is For
If you are a competent Java developer with a good understanding of concurrency but have no knowledge of how to effectively implement concurrent programs or use streams to make processes more efficient, then this book is for you.

What You Will Learn
  • Design concurrent applications by converting a sequential algorithm into a concurrent one
  • Discover how to avoid all the possible problems you can get in concurrent algorithms
  • Use the Executor framework to manage concurrent tasks without creating threads
  • Extend and modify Executors to adapt their behavior to your needs
  • Solve problems using the divide and conquer technique and the Fork/Join framework
  • Process massive data sets with parallel streams and Map/Reduce implementation
  • Control data-race conditions using concurrent data structures and synchronization mechanisms
  • Test and monitor concurrent applications
In Detail
Concurrency programming allows several large tasks to be divided into smaller sub-tasks, which are further processed as individual tasks that run in parallel. All the sub-tasks are combined together once the required results are achieved; they are then merged to get the final output. The whole process is very complex. This process goes from the design of concurrent algorithms to the testing phase where concurrent applications need extra attention. Java includes a comprehensive API with a lot of ready-to-use components to implement powerful concurrency applications in an easy way, but with a high flexibility to adapt these components to your needs.

The book starts with a full description of design principles of concurrent applications and how to parallelize a sequential algorithm. We'll show you how to use all the components of the Java Concurrency API from basics to the most advanced techniques to implement them in powerful concurrency applications in Java.

You will be using real-world examples of complex algorithms related to machine learning, data mining, natural language processing, image processing in client / server environments. Next, you will learn how to use the most important components of the Java 8 Concurrency API: the Executor framework to execute multiple tasks in your applications, the phaser class to implement concurrent tasks divided into phases, and the Fork/Join framework to implement concurrent tasks that can be split into smaller problems (using the divide and conquer technique). Toward the end, we will cover the new inclusions in Java 8 API, the Map and Reduce model, and the Map and Collect model. The book will also teach you about the data structures and synchronization utilities to avoid data-race conditions and other critical problems. Finally, the book ends with a detailed description of the tools and techniques that you can use to test a Java concurrent application.

Style and approach
A complete guide implementing real-world examples with algorithms related to machine learning, data mining, and natural language processing in client/server environments. All the examples are explained in a step-by-step approach.

Thursday, October 29, 2015

Install Oracle Java 8 on Ubuntu 15.10 via ppa:webupd8team


ppa:webupd8team/java is a Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7/JDK8/JDK9).

To install on Ubuntu 15.10, enter the commands in terminal:
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer


webupd8team/java also provide oracle-java8-set-default, automatically sets the Java 8 environment variables and sets JDK8 as the default JDK. To install it, use the following command:
$ sudo apt-get install oracle-java8-set-default




Tuesday, March 24, 2015

Pragmatic Unit Testing in Java 8 with JUnit

Pragmatic Unit Testing in Java 8 with JUnit

The Pragmatic Programmers classic is back! Freshly updated for modern software development, Pragmatic Unit Testing in Java 8 With JUnit teaches you how to write and run easily maintained unit tests in JUnit with confidence. You'll learn mnemonics to help you know what tests to write, how to remember all the boundary conditions, and what the qualities of a good test are. You'll see how unit tests can pay off by allowing you to keep your system code clean, and you'll learn how to handle the stuff that seems too tough to test.

Pragmatic Unit Testing in Java 8 With JUnit steps you through all the important unit testing topics. If you've never written a unit test, you'll see screen shots from Eclipse, IntelliJ IDEA, and NetBeans that will help you get past the hard part--getting set up and started.

Once past the basics, you'll learn why you want to write unit tests and how to effectively use JUnit. But the meaty part of the book is its collected unit testing wisdom from people who've been there, done that on production systems for at least 15 years: veteran author and developer Jeff Langr, building on the wisdom of Pragmatic Programmers Andy Hunt and Dave Thomas. You'll learn:
  • How to craft your unit tests to minimize your effort in maintaining them.
  • How to use unit tests to help keep your system clean.
  • How to test the tough stuff.
  • Memorable mnemonics to help you remember what's important when writing unit tests.
  • How to help your team reap and sustain the benefits of unit testing.
You won't just learn about unit testing in theory--you'll work through numerous code examples. When it comes to programming, hands-on is the only way to learn!

Thursday, January 29, 2015

The Java Tutorial: A Short Course on the Basics (6th Edition)


The Java Tutorial: A Short Course on the Basics (6th Edition) (Java Series), is based on the Java Platform, Standard Edition (Java SE) 8. This revised and updated edition introduces the new features added to the platform, including lambda expressions, default methods, aggregate operations, and more. An accessible and practical guide for programmers of any level, this book focuses on how to use the rich environment provided by Java to build applications, applets, and components.

Expanded coverage includes a chapter on the Date-Time API and a new chapter on annotations, with sections on type annotations and pluggable type systems as well as repeating annotations.

In addition, the updated sections “Security in Rich Internet Applications” and “Guidelines for Securing Rich Internet Applications” address key security topics. The latest deployment best practices are described in the chapter “Deployment in Depth.”

If you plan to take one of the Java SE 8 certification exams, this book can help. A special appendix, “Preparing for Java Programming Language Certification,” details the items covered on the available exams. Check online for updates.

All of the material has been thoroughly reviewed by members of Oracle Java engineering to ensure that the information is accurate and up to date. This book is based on the online tutorial hosted on Oracle Corporation’s website at http://docs.oracle.com/javase/tutorial.

Wednesday, January 14, 2015

Various Effect on JavaFX ImageView

This post show various Effect applied on ImageView.



package javafximage;

import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.embed.swing.SwingFXUtils;
import javafx.event.ActionEvent;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.SnapshotParameters;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.effect.Blend;
import javafx.scene.effect.BlendMode;
import javafx.scene.effect.Bloom;
import javafx.scene.effect.BlurType;
import javafx.scene.effect.BoxBlur;
import javafx.scene.effect.ColorAdjust;
import javafx.scene.effect.ColorInput;
import javafx.scene.effect.DisplacementMap;
import javafx.scene.effect.DropShadow;
import javafx.scene.effect.Effect;
import javafx.scene.effect.FloatMap;
import javafx.scene.effect.GaussianBlur;
import javafx.scene.effect.Glow;
import javafx.scene.effect.ImageInput;
import javafx.scene.effect.InnerShadow;
import javafx.scene.effect.Light;
import javafx.scene.effect.Lighting;
import javafx.scene.effect.MotionBlur;
import javafx.scene.effect.PerspectiveTransform;
import javafx.scene.effect.Reflection;
import javafx.scene.effect.SepiaTone;
import javafx.scene.effect.Shadow;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javax.imageio.ImageIO;

/**
 *
 * @web http://java-buddy.blogspot.com
 */
public class JavaFXImage extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        
        Image image = new Image("http://goo.gl/kYEQl");
        ImageView imageView = new ImageView();
        imageView.setImage(image);
        
        Image secondImage = new Image("http://goo.gl/Z6Qiw0");
        
        int imageWidth = (int) image.getWidth();
        int imageHeight = (int) image.getHeight();
        
        //Blend effect
        Blend blend = new Blend();
        blend.setMode(BlendMode.COLOR_BURN);
        ColorInput blendColorInput = new ColorInput();
        blendColorInput.setPaint(Color.STEELBLUE);
        blendColorInput.setX(0);
        blendColorInput.setY(0);
        blendColorInput.setWidth(imageWidth);
        blendColorInput.setHeight(imageHeight);
        blend.setTopInput(blendColorInput);
        
        //Bloom effect
        Bloom bloom = new Bloom(0.1);
        
        //BoxBlur effect
        BoxBlur boxBlur = new BoxBlur();
        boxBlur.setWidth(3);
        boxBlur.setHeight(3);
        boxBlur.setIterations(3);
        
        //ColorAdjust effect
        ColorAdjust colorAdjust = new ColorAdjust();
        colorAdjust.setContrast(0.1);
        colorAdjust.setHue(-0.05);
        colorAdjust.setBrightness(0.1);
        colorAdjust.setSaturation(0.2);
        
        //ColorInput effect
        ColorInput colorInput;
        colorInput = new ColorInput(0, 0, 
                imageWidth, imageHeight, Color.STEELBLUE);

        //DisplacementMap effect
        FloatMap floatMap = new FloatMap();
        floatMap.setWidth(imageWidth);
        floatMap.setHeight(imageHeight);

        for (int i = 0; i < imageWidth; i++) {
            double v = (Math.sin(i / 20.0 * Math.PI) - 0.5) / 40.0;
            for (int j = 0; j < imageHeight; j++) {
                floatMap.setSamples(i, j, 0.0f, (float) v);
            }
        }
        DisplacementMap displacementMap = new DisplacementMap();
        displacementMap.setMapData(floatMap);
        
        //DropShadow effect
        DropShadow dropShadow = new DropShadow();
        dropShadow.setRadius(5.0);
        dropShadow.setOffsetX(10.0);
        dropShadow.setOffsetY(5.0);
        dropShadow.setColor(Color.GREY);
        
        //GaussianBlur effect
        GaussianBlur gaussianBlur = new GaussianBlur();
        
        //Glow effect
        Glow glow = new Glow(1.0);
        
        //ImageInput effect
        ImageInput imageInput = new ImageInput(secondImage);
        
        //InnerShadow effect
        InnerShadow innerShadow = new InnerShadow(5.0, 5.0, 5.0, Color.AZURE);
        
        //Lighting effect
        Light.Distant light = new Light.Distant();
        light.setAzimuth(50.0);
        light.setElevation(30.0);
        light.setColor(Color.YELLOW);
        
        Lighting lighting = new Lighting();
        lighting.setLight(light);
        lighting.setSurfaceScale(50.0);
        
        //MotionBlur effect
        MotionBlur motionBlur = new MotionBlur();
        motionBlur.setRadius(30);
        motionBlur.setAngle(-15.0);
        
        //PerspectiveTransform effect
        PerspectiveTransform perspectiveTrasform = new PerspectiveTransform();
        perspectiveTrasform.setUlx(0.0);
        perspectiveTrasform.setUly(0.0);
        perspectiveTrasform.setUrx(imageWidth*1.5);
        perspectiveTrasform.setUry(0.0);
        perspectiveTrasform.setLrx(imageWidth*3);
        perspectiveTrasform.setLry(imageHeight*2);
        perspectiveTrasform.setLlx(0);
        perspectiveTrasform.setLly(imageHeight);
        
        //Reflection effect
        Reflection reflection = new Reflection();
        reflection.setFraction(0.7);
        
        //SepiaTone effect
        SepiaTone sepiaTone = new SepiaTone();
        
        //Shadow effect
        Shadow shadow = new Shadow(BlurType.THREE_PASS_BOX, Color.BLUE, 10.0);
        
        Effect effects[] = {
            null,
            blend,
            bloom,
            boxBlur,
            colorAdjust,
            colorInput,
            displacementMap,
            dropShadow,
            gaussianBlur,
            glow,
            imageInput,
            innerShadow,
            lighting,
            motionBlur,
            perspectiveTrasform,
            reflection,
            sepiaTone,
            shadow
        };
        
        ChoiceBox choiceBox = new ChoiceBox(
            FXCollections.observableArrayList(
                "null", "Blend", "Bloom", "BoxBlur", "ColorAdjust",
                "ColorInput", "DisplacementMap", "DropShadow",
                "GaussianBlur", "Glow", "ImageInput", "InnerShadow",
                "Lighting", "MotionBlur", "PerspectiveTransform",
                "Reflection", "SepiaTone", "Shadow"
            ));
        choiceBox.getSelectionModel().selectFirst();
        
        choiceBox.getSelectionModel().selectedIndexProperty()
            .addListener((ObservableValue<? extends Number> observable, 
                Number oldValue, Number newValue) -> {
            imageView.setEffect(effects[newValue.intValue()]);
        });
        
        ImageView retrievedImage = new ImageView();
        Label labelPath = new Label();
        
        Button btnSnapShot = new Button("Take SnapShot");
        btnSnapShot.setOnAction((ActionEvent event) -> {
            File savedFile = takeSnapShot(imageView);
            retrieveImage(savedFile, retrievedImage, labelPath);
        });
        
        Button btnSaveImage = new Button("Save");
        btnSaveImage.setOnAction((ActionEvent event) -> {
            File savedFile = saveImage(imageView);
            retrieveImage(savedFile, retrievedImage, labelPath);
        });

        VBox vBox = new VBox();
        vBox.setSpacing(5);
        vBox.setPadding(new Insets(5, 5, 5, 5));
        vBox.getChildren().addAll(choiceBox, imageView, btnSnapShot, 
                btnSaveImage, retrievedImage, labelPath);
        
        StackPane root = new StackPane();
        root.getChildren().add(vBox);

        Scene scene = new Scene(root, 400, 350);
        
        primaryStage.setTitle("java-buddy.blogspot.com");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
    
    //Take SnapShot and save
    private File takeSnapShot(Node node){

        WritableImage writableImage = node.snapshot(new SnapshotParameters(), null);
        
        File file = new File("snapshot.png");
        
        try {
            ImageIO.write(SwingFXUtils.fromFXImage(writableImage, null), "png", file);
            System.out.println("snapshot saved: " + file.getAbsolutePath());
            return file;
        } catch (IOException ex) {
            Logger.getLogger(JavaFXImage.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
    //Save Image of ImageView
    private File saveImage(ImageView iv){
        Image img = iv.getImage();
        File file = new File("savedImage.png");
        RenderedImage renderedImage = SwingFXUtils.fromFXImage(img, null);
        try {
            ImageIO.write(renderedImage, "png", file);
            System.out.println("Image saved: " + file.getAbsolutePath());
            return file;
        } catch (IOException ex) {
            Logger.getLogger(JavaFXImage.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
    //Retrieve saved image
    private void retrieveImage(File file, ImageView imageView, Label label){
        if(file != null){
            Image image = new Image(file.toURI().toString());
            imageView.setImage(image);
            
            label.setText(file.getName() + "\n"
                    + image.getWidth() + " x " + image.getHeight());
        }else{
            label.setText("");
            imageView.setImage(null);
        }
    }
}

Thursday, January 1, 2015

Beginning Java 8 Games Development

Beginning Java 8 Games Development , written by Java expert and author Wallace Jackson, teaches you the fundamentals of building a highly illustrative game using the Java 8 programming language. In this book, you'll employ open source software as tools to help you quickly and efficiently build your Java game applications. You'll learn how to utilize vector and bit-wise graphics; create sprites and sprite animations; handle events; process inputs; create and insert multimedia and audio files; and more.

Furthermore, you'll learn about JavaFX 8, now integrated into Java 8 and which gives you additional APIs that will make your game application more fun and dynamic as well as give it a smaller foot-print; so, your game application can run on your PC, mobile and embedded devices.

After reading and using this tutorial, you'll come away with a cool Java-based 2D game application template that you can re-use and apply to your own game making ambitions or for fun.

What you’ll learn
  • How to develop games using Java 8
  • How to employ vector-based graphics or bitmap graphics
  • How to create your 2D game sprites
  • How to animate those game sprites
  • How to handle events to process player input
  • How to optimize and implement digital audio assets

Who this book is for
This book is for game developers with little experience using Java, little experience in developing games, or both.

Table of Contents
1. Setting Up a Java 8 Game Development Environment
2. Setting Up Your Java 8 IDE
3. A Java 8 Primer
4. An Introduction to JavaFX 8
5. An Introduction to Game Design
6. The Foundation of Game Design
7. The Foundation of Game Play Loop
8. Creating Your Actor Engine
9. Controlling Your Action Figure
10. Directing the Cast of Actors
11. Moving Your Action Figure in 2D
12. Setting Boundaries for Your Action Figure in 2D
13. Animating Your Action Figure States
14. Setting Up the Game Environment
15. Implementing Game Audio Assets
16. Collision Detection
17. Enhancing Game Play

Wednesday, October 22, 2014

Beginning Java 8 APIs, Extensions and Libraries: Swing, JavaFX, JavaScript, JDBC and Network Programming APIs

Beginning Java 8 APIs, Extensions and Libraries: Swing, JavaFX, JavaScript, JDBC and Network Programming APIs completes the Apress learning Java journey and is a comprehensive approach to learning the Java programming language extensions and available APIs and libraries, including the new JavaFX APIs.

This book covers the key extensions of the Java programming language such as Swing, JavaFX, network programming, and JDBC. Each topic starts with a discussion of the topic's background. A step-by-step process, with small snippets of Java code, provides easy-to-follow instructions. At the end of a topic, a complete and ready-to-run Java program is provided. This book contains over 130 images and diagrams to help you visualize and better understand the topics. More than 130 complete programs allow you to practice and quickly learn the topics.

The Swing chapters discuss various aspects of working with a GUI, from the very basic concepts of developing a Swing application, to the most advanced topics, such as decorating a Swing component with a JLayer, drag-and-drop features, Synth Skinnable L&F, etc.

The chapter on network programming covers the basics of network technologies first, and then, the advanced topics of network programming, using a Java class library. It covers IPv4 and IPv6, addressing schemes, subnetting, supernetting, multicasting, TCP/IP sockets, UPD sockets, asynchronous socket I/O, etc.

The chapter on JDBC provides the details of connecting and working with databases such as Oracle, SQL Server, MySQL, DB2, Java DB (Apache Derby), Sybase, Adaptive Server Anywhere, etc. It contains a complete discussion on processing a ResultSet and a RowSet. It discusses how to use the RowSetFactory, to obtain a RowSet object of a specific type. Working with Large Objects (LOBs), such as Blob, Clob, and NClob, is covered in detail with Java code examples and database scripts.

What you’ll learn
  • How to extend your Java skills beyond the fundamental object oriented concepts and core language features
  • How to apply Java Swing for building Java front ends or user interfaces (UIs)
  • How to build small Java applications called applets
  • How to do Java network programming
  • How to connect with databases using JDBC APIs
  • How to work with JavaFX, RMI (Remote Method Invocation), and JNI (Java Native Interface)
  • How to use scripting in Java, including coverage of the Nashorn engine
Who this book is for
This tutorial is for Java programmers who are familiar with the fundamentals of the Java language and Java programming, who are now ready to call upon the power of extended Java functionality available from the huge array of Java APIs, extensions and libraries.

Table of Contents
1. Introduction to Swing
2. Swing Components
3. Advanced Swing
4. Applets
5. Network Programming
6. JDBC APIs
7. Java Remote Method Invocation
8. Java Native Interface
9. Introduction to JavaFX
10. Scripting in Java

Friday, October 17, 2014

Java 8 Recipes, 2nd Edition

Java 8 Recipes offers solutions to common programming problems encountered while developing Java-based applications. Fully updated with the newest features and techniques available, Java 8 Recipes provides code examples involving Lambdas, embedded scripting with Nashorn, the new date-time API, stream support, functional interfaces, and much more. Especial emphasis is given to features such as lambdas that are newly introduced in Java 8. Content is presented in the popular problem-solution format: Look up the programming problem that you want to solve. Read the solution. Apply the solution directly in your own code. Problem solved!

The problem-solution approach sets Java 8 Recipes apart. Java 8 Recipes is focused less on the language itself and more on what you can do with it that is useful. The book respects your time by always focusing on a task that you might want to perform using the language. Solutions come first. Explanations come later. You are free to crib from the book and apply the code examples directly to your own projects.
  • Covers the newly-released Java 8, including a brand new chapter on lambdas
  • Focuses especially on up-and-coming technologies such as Project Nashorn and Java FX 2.0
  • Respects your time by focusing on practical solutions you can implement in your own code
What you’ll learn
  • Develop Java SE applications using the latest in Java SE technology
  • Exploit the newly-introduced lambda features in Java 8
  • Build dynamic web applications with JavaScript and Project Nashorn
  • Create great-looking user interfaces with Java FX 2.0
  • Generate graphics and work with media such as sound and video
  • Add internationalization support to your Java applications
Who this book is for
Java 8 Recipes is aimed mainly at intermediate and experienced Java programmers. If you're past the point of being able to write "Hello, World", then you'll find Java 8 Recipes to be chock full of interesting and useful programming solutions to help you achieve your goals and meet with success in your Java programming projects.

Table of Contents
Chapter 1: Language Basics
Chapter 2: Java 8 JDK Enhancements
Chapter 3: Strings
Chapter 4: Numbers and Dates
Chapter 5: Object-Oriented Java
Chapter 6: Lambda Expressions
Chapter 7: Data Structures, Conditionals, and Collections
Chapter 8: Input and Output
Chapter 9: Exceptions and Logging
Chapter 10: Concurrency
Chapter 11: Debugging and Unit Testing
Chapter 12: Unicode, Internationalization, and Currency Codes
Chapter 13: Working with Databases
Chapter 14: JavaFX Fundamentals
Chapter 15: Graphics with JavaFX
Chapter 16: Media with JavaFX
Chapter 17: JavaFX on the Web
Chapter 18: Nashorn and Scripting
Chapter 19: Email
Chapter 20: XML Processing
Chapter 21: Networking
Chapter 22: Java 8 Security Enhancements

Thursday, October 16, 2014

Mastering Lambdas: Java Programming in a Multicore World

The Definitive Guide to Lambda Expressions: Mastering Lambdas: Java Programming in a Multicore World

Mastering Lambdas: Java Programming in a Multicore World describes how the lambda-related features of Java SE 8 will enable Java to meet the challenges of next-generation parallel hardware architectures. The book explains how to write lambdas, and how to use them in streams and in collection processing, providing code examples throughout. You'll learn how to use lambda expressions to take full advantage of performance improvements provided by today's multicore hardware. This Oracle Press book covers:
  • Why lambdas were needed, and how they will change Java programming
  • Syntax of lambda expressions
  • The basic operation of streams and pipelines
  • Using collectors and reduction to end pipelines
  • Creating streams
  • Spliterators, the fork/join framework, and exceptions
  • Examining stream performance with microbenchmarking
  • API evolution using default methods

Saturday, September 27, 2014

Java 8 in Action: Lambdas, Streams, and functional-style programming

Java 8 in Action: Lambdas, Streams, and functional-style programming

Java 8 in Action is a clearly written guide to the new features of Java 8. The book covers lambdas, streams, and functional-style programming. With Java 8's functional features you can now write more concise code in less time, and also automatically benefit from multicore architectures. It's time to dig in!

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the Book

Every new version of Java is important, but Java 8 is a game changer. Java 8 in Action is a clearly written guide to the new features of Java 8. It begins with a practical introduction to lambdas, using real-world Java code. Next, it covers the new Streams API and shows how you can use it to make collection-based code radically easier to understand and maintain. It also explains other major Java 8 features including default methods, Optional, CompletableFuture, and the new Date and Time API.

This book is written for programmers familiar with Java and basic OO programming.

What's Inside
  • How to use Java 8's powerful new features
  • Writing effective multicore-ready applications
  • Refactoring, testing, and debugging
  • Adopting functional-style programming
  • Quizzes and quick-check questions
About the Authors

Raoul-Gabriel Urma is a software engineer, speaker, trainer, and PhD candidate at the University of Cambridge. Mario Fusco is an engineer at Red Hat and creator of the lambdaj library. Alan Mycroft is a professor at Cambridge and cofounder of the Raspberry Pi Foundation.

Table of Contents

PART 1 FUNDAMENTALS
  • Java 8: why should you care?
  • Passing code with behavior parameterization
  • Lambda expressions
PART 2 FUNCTIONAL-STYLE DATA PROCESSING
  • Introducing streams
  • Working with streams
  • Collecting data with streams
  • Parallel data processing and performance
PART 3 EFFECTIVE JAVA 8 PROGRAMMING
  • Refactoring, testing, and debugging
  • Default methods
  • Using Optional as a better alternative to null
  • CompletableFuture: composable asynchronousprogramming
  • New Date and Time API
PART 4 BEYOND JAVA 8
  • Thinking functionally
  • Functional programming techniques
  • Blending OOP and FP: comparing Java 8 and Scala
  • Conclusions and where next for Java
APPENDIXES
  • Miscellaneous language updates
  • Miscellaneous library updates
  • Performing multiple operations in parallelon a stream
  • Lambdas and JVM bytecode

Wednesday, August 13, 2014

Java 8 in Action: Lambdas, Streams, and functional-style programming

While the term "lambda expression" may sound abstract and academic, Java 8 Lambdas can have a big impact on every day programming. In simplest terms, a lambda expression is a function—a bit of code—that can be passed to another method as an argument. Thus, a requirement can be changed by using a behavior, represented by a lambda, as a parameter. Java 8's functional programming features, like lambdas and the new Stream API that enables a cleaner way to iterate through collections, can help programmers write concise, maintainable code that scales easily and performs well on multicore architectures.

Java 8 in Action: Lambdas, Streams, and functional-style programming

Java 8 in Action is a clearly-written guide to Java 8 lambdas and functional programming in Java. It begins with a practical introduction to the structure and benefits of lambda expressions in real-world Java code and then introduces the Stream API, showing how it can make collections-related code radically easier to understand and maintain. It looks at new FP-oriented design patterns with Java 8 for code reuse, code readability, exception handling, data manipulation, and concurrency and concludes with a quick survey of useful functional features in Scala.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.


Thursday, July 3, 2014

Java: A Beginner's Guide, Sixth Edition



Essential Java Programming Skills--Made Easy!

Java: A Beginner's Guide, Sixth Edition

Fully updated for Java Platform, Standard Edition 8 (Java SE 8), Java: A Beginner's Guide, Sixth Edition gets you started programming in Java right away. Bestselling programming author Herb Schildt begins with the basics, such as how to create, compile, and run a Java program. He then moves on to the keywords, syntax, and constructs that form the core of the Java language. This Oracle Press resource also covers some of Java's more advanced features, including multithreaded programming, generics, and Swing. Of course, new Java SE 8 features such as lambda expressions and default interface methods are described. An introduction to JavaFX, Java's newest GUI, concludes this step-by-step tutorial.

Designed for Easy Learning:
  • Key Skills & Concepts -- Chapter-opening lists of specific skills covered in the chapter
  • Ask the Expert -- Q&A sections filled with bonus information and helpful tips
  • Try This -- Hands-on exercises that show you how to apply your skills
  • Self Tests -- End-of-chapter quizzes to reinforce your skills
  • Annotated Syntax -- Example code with commentary that describes the programming techniques being illustrated
The book's code examples are available FREE for download.

Wednesday, July 2, 2014

Java: The Complete Reference, Ninth Edition



Fully updated for Java SE 8

Java: The Complete Reference, Ninth Edition

Java: The Complete Reference, Ninth Edition explains how to develop, compile, debug, and run Java programs. Bestselling programming author Herb Schildt covers the entire Java language, including its syntax, keywords, and fundamental programming principles, as well as significant portions of the Java API library. JavaBeans, servlets, applets, and Swing are examined and real-world examples demonstrate Java in action. New Java SE 8 features such as lambda expressions, the stream library, and the default interface method are discussed in detail. This Oracle Press resource also offers a solid introduction to JavaFX.

Coverage includes:

  • Data types, variables, arrays, and operators
  • Control statements
  • Classes, objects, and methods
  • Method overloading and overriding
  • Inheritance
  • Interfaces and packages
  • Exception handling
  • Multithreaded programming
  • Enumerations, autoboxing, and annotations
  • The I/O classes
  • Generics
  • Lambda expressions
  • String handling
  • The Collections Framework
  • Networking
  • Event handling
  • AWT and Swing
  • The Concurrent API
  • The Stream API
  • Regular expressions
  • JavaFX
  • JavaBeans
  • Applets and servlets
  • Much, much more

Tuesday, May 6, 2014

Java 8 Launch videos published

Videos of Java 8 Launch uploaded to Youtube.

Saturday, April 19, 2014

Functional Programming in Java: Harnessing the Power Of Java 8 Lambda Expressions

Intermediate level, for programmers fairly familiar with Java, but new to the functional style of programming and lambda expressions.

Functional Programming in Java: Harnessing the Power Of Java 8 Lambda Expressions

Get ready to program in a whole new way. Functional Programming in Java will help you quickly get on top of the new, essential Java 8 language features and the functional style that will change and improve your code. This short, targeted book will help you make the paradigm shift from the old imperative way to a less error-prone, more elegant, and concise coding style that's also a breeze to parallelize. You'll explore the syntax and semantics of lambda expressions, method and constructor references, and functional interfaces. You'll design and write applications better using the new standards in Java 8 and the JDK.

Lambda expressions are lightweight, highly concise anonymous methods backed by functional interfaces in Java 8. You can use them to leap forward into a whole new world of programming in Java. With functional programming capabilities, which have been around for decades in other languages, you can now write elegant, concise, less error-prone code using standard Java. This book will guide you though the paradigm change, offer the essential details about the new features, and show you how to transition from your old way of coding to an improved style.

In this book you'll see popular design patterns, such as decorator, builder, and strategy, come to life to solve common design problems, but with little ceremony and effort. With these new capabilities in hand, Functional Programming in Java will help you pick up techniques to implement designs that were beyond easy reach in earlier versions of Java. You'll see how you can reap the benefits of tail call optimization, memoization, and effortless parallelization techniques.

Java 8 will change the way you write applications. If you're eager to take advantage of the new features in the language, this is the book for you.

What you need:
Java 8 with support for lambda expressions and the JDK is required to make use of the concepts and the examples in this book.

Thursday, March 27, 2014

What's New for JavaFX in Java SE 8

Ported to new embedded platforms, JavaFX 8 contains many new and exciting features including enhancements to WebView's HTML5 support , 3D, embedding Swing nodes inside a JavaFX Scene Graph, new UI controls, a new visual theme and much more.

Tuesday, March 18, 2014

Java SE 8 released

Java SE 8 contains several new features and enhancements that increase the performance of existing applications, make it easier to develop applications for modern platforms, and increase maintainability of code.

Download Java Platform (JDK) 8 or JDK 8 & NetBeans 8.0 HERE.

Monday, March 10, 2014

Java 8 Launch Webcast, on March 25th 2014

To celebrate the launch of Java SE 8, Oracle will host a live webcast on March 25th 2014, 10am PST. This event will feature:
  • Welcome from Mark Reinhold, Chief Architect, Java Platform Group.
  • A panel discussion look at Java SE 8 new features and enhancements by members of Java Engineering
  • Short comments from companies using Java and community members
  • A panel discussion on Java 8 and the Internet of Things (IoT)
  • A LIVE chat to answer your questions
    - You can post questions now
    - Use #Java8QA during the event
  • Over 25 videos introducing the features of Java 8 will be available
Details and Register HERE.










Sunday, March 9, 2014

Java SE 8 for the Really Impatient

Eagerly anticipated by millions of programmers, Java SE 8 is the most important Java update in many years. The addition of lambda expressions (closures) and streams represents the biggest change to Java programming since the introduction of generics and annotations.

Now, with Java SE 8 for the Really Impatient , internationally renowned Java author Cay S. Horstmann concisely introduces Java 8’s most valuable new features (plus a few Java 7 innovations that haven’t gotten the attention they deserve). If you’re an experienced Java programmer, Horstmann’s practical insights and sample code will help you quickly take advantage of these and other Java language and platform improvements. This indispensable guide includes
  • Coverage of using lambda expressions (closures) to write computation “snippets” that can be passed to utility functions
  • The brand-new streams API that makes Java collections far more flexible and efficient
  • Major updates to concurrent programming that make use of lambda expressions (filter/map/reduce) and that provide dramatic performance improvements for shared counters and hash tables
  • A full chapter with advice on how you can put lambda expressions to work in your own programs
  • Coverage of the long-awaited introduction of a well-designed date/time/calendar library (JSR 310)
  • A concise introduction to JavaFX, which is positioned to replace Swing GUIs, and to the Nashorn Javascript engine
  • A thorough discussion of many small library changes that make Java programming more productive and enjoyable
This is the first title to cover all of these highly anticipated improvements and is invaluable for anyone who wants to write tomorrow’s most robust, efficient, and secure Java code. 

Java SE 8 for the Really Impatient