Coder Social home page Coder Social logo

jdk8-lambda-tour's Introduction

This repository contains example files I use in my JDK8 / Lambdas / Streams / Collectors talks.

The data files mcdonalds.csv, movies-mpaa.txt, ospd.txt and words.shakespeare.txt can be freely downloaded from Robert Sedgwick page here: http://introcs.cs.princeton.edu/java/data/. By the way, there are other very interesting data sets on this page.

You can find 3 examples here :

  • the Scrabble example, or "how good at Scrabble Shakespeare would have been?"
  • the MacDonald example, or "Houston, we've got a problem"
  • the Movie database example.

All files are provided under the GPL license. All data sets files are under the copyright of their authors, and provided for convenience only.

More on "how good at Scrabble Shakespeare would have been". I realized that the best words are in fact not playable in Scrabble : not enough letters to place buzzards and whizzing on a Scrabble board. But there are two blanks letters in the Scrabble game. So let's take into account that in fact, buzzards and whizzing are doable with blank letters, and let's change the computation of the score to take into account that the blank letters score 0.

Nice little problem, and it turns out that it is still solvable with a map / filter / reduce approach, thus fully lambda based. Great !

More on the Movie database example.

A nice question I had on this example is : "and how about the most seen duo of actors". This question is pretty straigthforward if your actors are in a DB with a basic SQL engine. With the Stream API, it's a bit trickier, and cant be solved using a brute force method, due to the number of cases to evaluate. There's no Collector for that, to we have to build our own. And if we want to go parallel, we need to be careful about using concurrent structures.

jdk8-lambda-tour's People

Contributors

josepaumard avatar ebourg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.