SlideShare una empresa de Scribd logo
1 de 77
whoiam
Developer Advocate @JFrog
@jbaruch on the internetz
whoiam
Solutions Architect @Hazelcast
@gAmUssA on the internetz
BTW,
1. Two entertaining guys on stage
2. Funny Puzzling questions
3. You think and vote
4. Awesome t-shirts fly in the air
5. Official twitter handle!
JAVA8puzzlers
Watching the puzzlers like… #dafaq
Everything works (or doesn't) in the latest
Java 8 update
Broken Eggs Tale
What will be the output?
A. milk/bread/sausage
B. milk/bread/sausage/eggs, don’t forget
eggs!
C.
List<String> list = new ArrayList<>();
list.add("milk");
list.add("bread");
list.add("sausage");
Stream<String> stream = list.stream();
list.add("eggs, don’t forget eggs!");
stream.forEach(System.out::println);
Late binding, duh…
List<String> list = new ArrayList<>();
list.add("milk");
list.add("bread");
list.add("sausage");
Stream<String> stream = list.stream();
list.add("eggs, don’t forget eggs!");
stream.forEach(System.out::println);
Late binding, duh…
List<String> list = new ArrayList<>();
list.add("milk");
list.add("bread");
list.add("sausage");
Stream<String> stream = list.stream();
list.add("eggs, don’t forget eggs!");
stream.forEach(System.out::println);
Going Vegan
What will be the output?
A. milk/bread/sausage
B. milk/bread/eggs, don’t forget eggs!
C. milk/bread/ConcurrentModificationException
D. ConcurrentModificationException
List<String> list = new ArrayList<>();
list.add("milk");
list.add("bread");
list.add("sausage");
list = list.subList(0, 2); //No sausage, please!
Stream<String> stream = list.stream();
list.add("eggs, don’t forget eggs!");
stream.forEach(System.out::println);
Sometimes it’s just a bug…
Execute ’em all
What’s the difference between 1 and 2?
A. 1 compiles, 2 does not
B. 2 compiles, 1 does not
C. Same same, both work fine
D. Same same, both won’t compile
public void killAll(){
ExecutorService ex = Executors.newSingleThreadExecutor();
List<String> sentence = Arrays.asList("Punish");
ex.submit(() -> Files.write(Paths.get("Sentence.txt"), sentence) ); // 1
ex.submit(() -> { Files.write(Paths.get("Sentence.txt"), sentence); }); // 2
}
Semicolons are the evil!
What’s the difference between 1 and 2?
A. 1 compiles, 2 does not
B. 2 compiles, 1 does not
C. Same same, both work fine
D. Same same, both won’t compile
public void killAll(){
ExecutorService ex = Executors.newSingleThreadExecutor();
List<String> sentence = Arrays.asList("Punish");
ex.submit(() -> Files.write(Paths.get("Sentence.txt"), sentence) ); // 1
ex.submit(() -> { Files.write(Paths.get("Sentence.txt"), sentence); }); // 2
}
public void killAll(){
ExecutorService ex = Executors.newSingleThreadExecutor();
List<String> sentence = Arrays.asList("Punish");
ex.submit(() -> Files.write(Paths.get("Sentence.txt"), sentence) ); // 1
ex.submit(() -> { Files.write(Paths.get("Sentence.txt"), sentence); }); // 2
}
@FunctionalInterface
public interface Runnable {
public abstract void run();
}
@FunctionalInterface
public interface Callable<V> {
V call() throws Exception;
}
Mad Max
How that will work?
A. Compilation error
B. Runtime Exception
C. 3
D. Something else
System.out.println(
Stream.of(-3, -2, -1, 0, 1, 2, 3).max(Math::max).get()
);
How about now?
A. −3
B. −1
C. 0
D. Something else
System.out.println(
Stream.of(-3, -2, -1, 0, 1, 2, 3).max(Math::max).get()
);
How about now?
A. −3
B. −1
C. 0
D. Something else
System.out.println(
Stream.of(-3, -2, -1, 0, 1, 2, 3).max(Math::max).get()
);
• Math.max(−3, −2) = −2 < 0  −3 < −2,
selecting−2
• Math.max(−2, −1) = −1 < 0  −2 < −1,
selecting−1
• Math.max(−1, 0) = 0  −1 == 0,
keeping−1
• Math.max(−1, 1) = 1 > 0  −1 > 1, keeping−1
• Math.max(−1, 2) = 2 > 0  −1 > 2, keeping−1
• Math.max(−1, 3) = 3 > 0  −1 > 3, keeping−1
Stream.of(-3, -2, -1, 0, 1, 2, 3).max(Math::max).get()
Let’s upgrade the stack!
What will happen?
A.Maps will switch
B.Both will become oldSchool
C.Both will become hipster
D.Really?! That won’t even compile!
Map<String, String> oldSchool = initOldSchoolStack();
// oldSchool = {buildTool=maven, lang=java, db=db2}
Map<String, String> proper = initHipsterStack();
// proper = {buildTool=npm, lang=javascript, db=elastic}
oldSchool.replaceAll(proper::put);
void replaceAll(BiFunction<? super K, ? super V, ? extends V> function)
V put(K key, V value);
Map interface
oldSchool.replaceAll(proper::put);
void replaceAll(BiFunction<? super K, ? super V, ? extends V> function)
V put(K key, V value);
Map interface
final BiFunction<String, String, String> function =
(key, value) -> proper.put(key, value);
for (Map.Entry<String, String> entry : oldSchool.entrySet())
entry.setValue(function.apply(entry.getKey(), entry.getValue()));
void replaceAll(BiFunction<? super K, ? super V, ? extends V> function)
V put(K key, V value);
Map interface
final BiFunction<String, String, String> function =
(key, value) -> proper.put(key, value);
for (Map.Entry<String, String> entry : oldSchool.entrySet())
entry.setValue(function.apply(entry.getKey(), entry.getValue()));
How many lines will be the same?
List<String> kitties = Arrays.asList("Soft", "Warm", "Purr");
Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder());
System.out.println(Collections.max(kitties, kittiesComparator));
System.out.println(kitties.stream().collect(Collectors.maxBy(kittiesComparator)).get());
System.out.println(kitties.stream().max(kittiesComparator).get());
A.All lines the same
B.Two lines the same
C.All different
D.Four different
How about now?
List<String> kitties = Arrays.asList("Soft", null, "Purr");
Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder());
System.out.println(Collections.max(kitties, kittiesComparator));
System.out.println(kitties.stream().collect(Collectors.maxBy(kittiesComparator)).get());
System.out.println(kitties.stream().max(kittiesComparator).get());
A.All lines the same
B.Two lines the same
C.All different
D.Four different
How about now?
List<String> kitties = Arrays.asList("Soft", null, "Purr");
Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder());
System.out.println(Collections.max(kitties, kittiesComparator));
System.out.println(kitties.stream().collect(Collectors.maxBy(kittiesComparator)).get());
System.out.println(kitties.stream().max(kittiesComparator).get());
A.All lines the same
B.Two lines the same
C.All different
D.Four different
List<String> kitties = Arrays.asList("Soft", null, "Purr");
Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder());
System.out.println(Collections.max(kitties, kittiesComparator));
List<String> kitties = Arrays.asList("Soft", null, "Purr");
Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder());
System.out.println(kitties.stream().collect(Collectors.maxBy(kittiesComparator)).get());
List<String> kitties = Arrays.asList("Soft", null, "Purr");
Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder());
System.out.println(kitties.stream().max(kittiesComparator).get());
null
Caught: java.lang.NoSuchElementException
Caught: java.lang.NullPointerException
Consistency, yeah.
Mutants
How to cast to a type without declaring it?
interface Cat{ default void meow() {System.out.println(”meow ");}}
interface Dog{ default void bark() {System.out.println(”woof ");}}
public static void main(String[] args) {
class Dogcatimplements Dog, Cat{}
test(new Dogcat());
}
static void test(Object obj) {
def x = (?)obj;
x.meow ();
x.bark ();
}
How to cast to a type without declaring it?
static void test(Object obj) {
// A. Will that work?
Dog& Catx = (Dog& Cat) obj;
x.meow ();
x.bark ();
}
static void test(Object obj) {
// B. Will that work?
((Consumer<? extends Dog& Cat>)(x -> {
x.meow ();
x.bark ();
})).accept((Dog& Cat)obj); }
static void test(Object obj) {
// C. Will that work?
Optional.of((Dog& Cat) obj)
.ifPresent(x -> {
x.meow ();
x.bark ();
});}
// D. You’re two sick bastards.
interface Cat{ default void meow() {System.out.println(”meow");}}
interface Dog{ default void bark() {System.out.println(”woof");}}
public static void main(String[] args) {
class Dogcat implements Dog, Cat{}
test(new Dogcat());
}
How to cast to a type without declaring it?
static void test(Object obj) {
// A. Will that work?
Dog & Cat x = (Dog & Cat) obj;
x.meow();
x.bark();
}
static void test(Object obj) {
// B. Will that work?
((Consumer<? extends Dog & Cat>)(x -> {
x.meow();
x.bark();
})).accept((Dog & Cat)obj); }
static void test(Object obj) {
// C. Will that work?
Optional.of((Dog & Cat) obj)
.ifPresent(x -> {
x.meow();
x.bark();
});}
// D. You’re two sick bastards.
interface Cat{ default void meow() {System.out.println(”meow");}}
interface Dog{ default void bark() {System.out.println(”woof");}}
public static void main(String[] args) {
static class Dogcat implements Dog, Cat{}
test(new Dogcat());
}
Bill Gates explains how that works
static void test(Object obj) {
// C. Will that work?
Optional.of((Dog & Cat) obj)
.ifPresent(x -> {
x.meow();
x.bark();
});}
Viktor Gamov and Baruch Sadogursky
call customer service:
What will be the output?
1. HOTEL ECHO LIMA LIMA OSCAR/ HOTEL ECHO LIMA LIMA
OSCAR
2. HELLO / HOTEL ECHO LIMA LIMA OSCAR
3. HOTEL ECHO LIMA LIMA OSCAR/ HELLO
4. HELLO/HELLO
public class Test {
String str;
void run() {
str = "hello ";
Supplier<String> s1 = str::toUpperCase;
Supplier<String> s2 = () -> str.toUpperCase();
str = "Hotel Echo Lima Lima Oscar ";
System.out.println(s1.get());
System.out.println(s2.get());
}
}
What will be the output?
1. HOTEL ECHO LIMA LIMA OSCAR/ HOTEL ECHO LIMA LIMA
OSCAR
2. HELLO / HOTEL ECHO LIMA LIMA OSCAR
3. HOTEL ECHO LIMA LIMA OSCAR/ HELLO
4. HELLO/HELLO
public class Test {
String str;
void run() {
str = ”hello";
Supplier<String> s1 = str::toUpperCase;
Supplier<String> s2 = () -> str.toUpperCase();
str = ”Hotel Echo Lima Lima Oscar";
System.out.println(s1.get());
System.out.println(s2.get());
}
}
What will happen?
1. ConcurrentModificationException
2. ArrayIndexOutOfBoundsException
3. NullPointerException
4. No exceptions, all good
List<String> list = new ArrayList<>(Arrays.asList("Arnie", "Chuck", "Slay"));
list.stream().forEach(x -> {
if(x.equals("Chuck")) {
list.remove(x);
}
});
Java 8 vs Chuck Norris
What will happen?
A. ConcurrentModificationException
B. ArrayIndexOutOfBoundsException
C. NullPointerException
D. No exceptions, all good
List<String> list = new ArrayList<>(Arrays.asList("Arnie", "Chuck", "Slay"));
list.stream().forEach(x -> {
if(x.equals("Chuck")) {
list.remove(x);
}
});
Here’s why:
stream().forEach()  spliterator().forEachRemaining()
forEachRemaining checks for mod count once, in the end
Removing element adds null to the end of the array:
["Arne", "Chuck", "Slay"]  ["Arne", "Slay", null]
On the last iteration if(null.equals("Chuck")) fails with NPE
(didn’t get to CME)
Use list.removeIf("Chuck"::equals);
System.out.println(Optional.of("rtfm").orElseGet(null));
System.out.println(Optional.empty().map(null).orElse("rtfm"));
What will be the output?
A.rtfm / rtfm
B.rtfm / NullPointerException
C.NullPointerException / NullPointerException
D.NullPointerException / rtfm
System.out.println(Optional.of("rtfm").orElseGet(null));
System.out.println(Optional.empty().map(null).orElse("rtfm"));
What will be the output?
A.rtfm /rtfm
B.rtfm / NullPointerException
C.NullPointerException / NullPointerException
D.NullPointerException / rtfm
Conclusions
- Write readable code!
- Comment all the tricks
- Sometimes it’s a bug
- Static code analysis FTW - intellij IDEA!
- Rtfm
- Don’t abuse lambdas and streams!
- Trust us, we have much more where those came
from.
- Puzzlers? Gotchas? Fetal position inducing
behavior?
- puzzlers jfrog.com
Did you like it?
Praise us on twitter and in the feedback form!
- java8puzzlers
- gamussa
- jbaruch
Didn’t like it?
/dev/null

Más contenido relacionado

La actualidad más candente

JPoint 2016 - Валеев Тагир - Странности Stream API
JPoint 2016 - Валеев Тагир - Странности Stream APIJPoint 2016 - Валеев Тагир - Странности Stream API
JPoint 2016 - Валеев Тагир - Странности Stream APItvaleev
 
Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?tvaleev
 
Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012Leonardo Borges
 
Predictably
PredictablyPredictably
Predictablyztellman
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistAnton Arhipov
 
The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212Mahmoud Samir Fayed
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Baruch Sadogursky
 
Python Performance 101
Python Performance 101Python Performance 101
Python Performance 101Ankur Gupta
 
JavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java DevelopersJavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java DevelopersJan Kronquist
 
Programmation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScriptProgrammation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScriptLoïc Knuchel
 
Best Java Problems and Solutions
Best Java Problems and SolutionsBest Java Problems and Solutions
Best Java Problems and SolutionsJava Projects
 
java 8 Hands on Workshop
java 8 Hands on Workshopjava 8 Hands on Workshop
java 8 Hands on WorkshopJeanne Boyarsky
 

La actualidad más candente (20)

JPoint 2016 - Валеев Тагир - Странности Stream API
JPoint 2016 - Валеев Тагир - Странности Stream APIJPoint 2016 - Валеев Тагир - Странности Stream API
JPoint 2016 - Валеев Тагир - Странности Stream API
 
Java.lang.object
Java.lang.objectJava.lang.object
Java.lang.object
 
Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?Joker 2015 - Валеев Тагир - Что же мы измеряем?
Joker 2015 - Валеев Тагир - Что же мы измеряем?
 
Why Learn Python?
Why Learn Python?Why Learn Python?
Why Learn Python?
 
Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012Continuation Passing Style and Macros in Clojure - Jan 2012
Continuation Passing Style and Macros in Clojure - Jan 2012
 
Predictably
PredictablyPredictably
Predictably
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
Java VS Python
Java VS PythonJava VS Python
Java VS Python
 
Kotlin standard
Kotlin standardKotlin standard
Kotlin standard
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with Javassist
 
The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
 
Python Performance 101
Python Performance 101Python Performance 101
Python Performance 101
 
Google Guava
Google GuavaGoogle Guava
Google Guava
 
JavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java DevelopersJavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java Developers
 
Programmation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScriptProgrammation fonctionnelle en JavaScript
Programmation fonctionnelle en JavaScript
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
Best Java Problems and Solutions
Best Java Problems and SolutionsBest Java Problems and Solutions
Best Java Problems and Solutions
 
java 8 Hands on Workshop
java 8 Hands on Workshopjava 8 Hands on Workshop
java 8 Hands on Workshop
 

Destacado

WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java DevelopersWebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java DevelopersViktor Gamov
 
Functional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIAFunctional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIAViktor Gamov
 
Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray Baruch Sadogursky
 
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»Viktor Gamov
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...Baruch Sadogursky
 
Spring Data: New approach to persistence
Spring Data: New approach to persistenceSpring Data: New approach to persistence
Spring Data: New approach to persistenceOleksiy Rezchykov
 
Testing Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupTesting Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupViktor Gamov
 
Morning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversaryMorning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversaryTaras Matyashovsky
 
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
Couchbase Sydney meetup #1    Couchbase Architecture and ScalabilityCouchbase Sydney meetup #1    Couchbase Architecture and Scalability
Couchbase Sydney meetup #1 Couchbase Architecture and ScalabilityKarthik Babu Sekar
 
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017Baruch Sadogursky
 
Javaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring bootJavaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring bootIvan Vasyliev
 
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Baruch Sadogursky
 
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Baruch Sadogursky
 
The Delivery Hero - A Simpsons As A Service Storyboard
The Delivery Hero - A Simpsons As A Service StoryboardThe Delivery Hero - A Simpsons As A Service Storyboard
The Delivery Hero - A Simpsons As A Service StoryboardChristoph Engelbert
 
Java 8 Puzzlers as it was presented at Codemash 2017
Java 8 Puzzlers as it was presented at Codemash 2017Java 8 Puzzlers as it was presented at Codemash 2017
Java 8 Puzzlers as it was presented at Codemash 2017Baruch Sadogursky
 
Java Puzzlers NG S02: Down the Rabbit Hole as presented at Devoxx US 2017
Java Puzzlers NG S02: Down the Rabbit Hole as presented at Devoxx US 2017Java Puzzlers NG S02: Down the Rabbit Hole as presented at Devoxx US 2017
Java Puzzlers NG S02: Down the Rabbit Hole as presented at Devoxx US 2017Baruch Sadogursky
 
Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Oliver Gierke
 

Destacado (20)

Java 8 puzzlers
Java 8 puzzlersJava 8 puzzlers
Java 8 puzzlers
 
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java DevelopersWebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
 
Functional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIAFunctional UI testing of Adobe Flex RIA
Functional UI testing of Adobe Flex RIA
 
Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray Creating your own private Download Center with Bintray
Creating your own private Download Center with Bintray
 
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
JavaOne 2013: «Java and JavaScript - Shaken, Not Stirred»
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code SF...
 
Spring Data: New approach to persistence
Spring Data: New approach to persistenceSpring Data: New approach to persistence
Spring Data: New approach to persistence
 
Testing Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user groupTesting Flex RIAs for NJ Flex user group
Testing Flex RIAs for NJ Flex user group
 
Confession of an Engineer
Confession of an EngineerConfession of an Engineer
Confession of an Engineer
 
Morning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversaryMorning at Lohika 2nd anniversary
Morning at Lohika 2nd anniversary
 
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
Couchbase Sydney meetup #1    Couchbase Architecture and ScalabilityCouchbase Sydney meetup #1    Couchbase Architecture and Scalability
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
 
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
 
Javaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring bootJavaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring boot
 
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
 
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
 
The Delivery Hero - A Simpsons As A Service Storyboard
The Delivery Hero - A Simpsons As A Service StoryboardThe Delivery Hero - A Simpsons As A Service Storyboard
The Delivery Hero - A Simpsons As A Service Storyboard
 
Java 8 Puzzlers as it was presented at Codemash 2017
Java 8 Puzzlers as it was presented at Codemash 2017Java 8 Puzzlers as it was presented at Codemash 2017
Java 8 Puzzlers as it was presented at Codemash 2017
 
Boot in Production
Boot in ProductionBoot in Production
Boot in Production
 
Java Puzzlers NG S02: Down the Rabbit Hole as presented at Devoxx US 2017
Java Puzzlers NG S02: Down the Rabbit Hole as presented at Devoxx US 2017Java Puzzlers NG S02: Down the Rabbit Hole as presented at Devoxx US 2017
Java Puzzlers NG S02: Down the Rabbit Hole as presented at Devoxx US 2017
 
Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!
 

Similar a Java 8 Puzzlers [as presented at OSCON 2016]

2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good TestsTomek Kaczanowski
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql JOYITAKUNDU1
 
Pick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitPick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitVaclav Pech
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVMVaclav Pech
 
LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기Wanbok Choi
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginnersishan0019
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good TestsTomek Kaczanowski
 
About java
About javaAbout java
About javaJay Xu
 
Modern technologies in data science
Modern technologies in data science Modern technologies in data science
Modern technologies in data science Chucheng Hsieh
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemSages
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistAnton Arhipov
 
Java Generics for Dummies
Java Generics for DummiesJava Generics for Dummies
Java Generics for Dummiesknutmork
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Víctor Bolinches
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)Chhom Karath
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on AndroidTomáš Kypta
 

Similar a Java 8 Puzzlers [as presented at OSCON 2016] (20)

2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
 
Pick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitPick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruit
 
Utility.ppt
Utility.pptUtility.ppt
Utility.ppt
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginners
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 
Nantes Jug - Java 7
Nantes Jug - Java 7Nantes Jug - Java 7
Nantes Jug - Java 7
 
About java
About javaAbout java
About java
 
Modern technologies in data science
Modern technologies in data science Modern technologies in data science
Modern technologies in data science
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with Javassist
 
What is new in Java 8
What is new in Java 8What is new in Java 8
What is new in Java 8
 
Java Generics for Dummies
Java Generics for DummiesJava Generics for Dummies
Java Generics for Dummies
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
 
Unit testing concurrent code
Unit testing concurrent codeUnit testing concurrent code
Unit testing concurrent code
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
 

Más de Baruch Sadogursky

DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...
DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...
DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...Baruch Sadogursky
 
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...Baruch Sadogursky
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...Baruch Sadogursky
 
Data driven devops as presented at QCon London 2018
Data driven devops as presented at QCon London 2018Data driven devops as presented at QCon London 2018
Data driven devops as presented at QCon London 2018Baruch Sadogursky
 
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018Baruch Sadogursky
 
Java Puzzlers NG S03 a DevNexus 2018
Java Puzzlers NG S03 a DevNexus 2018Java Puzzlers NG S03 a DevNexus 2018
Java Puzzlers NG S03 a DevNexus 2018Baruch Sadogursky
 
Where the Helm are your binaries? as presented at Canada Kubernetes Meetups
Where the Helm are your binaries? as presented at Canada Kubernetes MeetupsWhere the Helm are your binaries? as presented at Canada Kubernetes Meetups
Where the Helm are your binaries? as presented at Canada Kubernetes MeetupsBaruch Sadogursky
 
Data driven devops as presented at Codemash 2018
Data driven devops as presented at Codemash 2018Data driven devops as presented at Codemash 2018
Data driven devops as presented at Codemash 2018Baruch Sadogursky
 
A Research Study into DevOps Bottlenecks as presented at Codemash 2018
A Research Study into DevOps Bottlenecks as presented at Codemash 2018A Research Study into DevOps Bottlenecks as presented at Codemash 2018
A Research Study into DevOps Bottlenecks as presented at Codemash 2018Baruch Sadogursky
 
Best Practices for Managing Docker Versions as presented at JavaOne 2017
Best Practices for Managing Docker Versions as presented at JavaOne 2017Best Practices for Managing Docker Versions as presented at JavaOne 2017
Best Practices for Managing Docker Versions as presented at JavaOne 2017Baruch Sadogursky
 
Troubleshooting & Debugging Production Microservices in Kubernetes as present...
Troubleshooting & Debugging Production Microservices in Kubernetes as present...Troubleshooting & Debugging Production Microservices in Kubernetes as present...
Troubleshooting & Debugging Production Microservices in Kubernetes as present...Baruch Sadogursky
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017Baruch Sadogursky
 
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...Baruch Sadogursky
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...Baruch Sadogursky
 
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...Baruch Sadogursky
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...Baruch Sadogursky
 
Let’s Wing It: A Study in DevRel Strategy
 Let’s Wing It: A Study in DevRel Strategy Let’s Wing It: A Study in DevRel Strategy
Let’s Wing It: A Study in DevRel StrategyBaruch Sadogursky
 
Log Driven First Class Customer Support at Scale
Log Driven First Class Customer Support at ScaleLog Driven First Class Customer Support at Scale
Log Driven First Class Customer Support at ScaleBaruch Sadogursky
 
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOpsBaruch Sadogursky
 
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...Baruch Sadogursky
 

Más de Baruch Sadogursky (20)

DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...
DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...
DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...
 
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...
 
Data driven devops as presented at QCon London 2018
Data driven devops as presented at QCon London 2018Data driven devops as presented at QCon London 2018
Data driven devops as presented at QCon London 2018
 
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018
 
Java Puzzlers NG S03 a DevNexus 2018
Java Puzzlers NG S03 a DevNexus 2018Java Puzzlers NG S03 a DevNexus 2018
Java Puzzlers NG S03 a DevNexus 2018
 
Where the Helm are your binaries? as presented at Canada Kubernetes Meetups
Where the Helm are your binaries? as presented at Canada Kubernetes MeetupsWhere the Helm are your binaries? as presented at Canada Kubernetes Meetups
Where the Helm are your binaries? as presented at Canada Kubernetes Meetups
 
Data driven devops as presented at Codemash 2018
Data driven devops as presented at Codemash 2018Data driven devops as presented at Codemash 2018
Data driven devops as presented at Codemash 2018
 
A Research Study into DevOps Bottlenecks as presented at Codemash 2018
A Research Study into DevOps Bottlenecks as presented at Codemash 2018A Research Study into DevOps Bottlenecks as presented at Codemash 2018
A Research Study into DevOps Bottlenecks as presented at Codemash 2018
 
Best Practices for Managing Docker Versions as presented at JavaOne 2017
Best Practices for Managing Docker Versions as presented at JavaOne 2017Best Practices for Managing Docker Versions as presented at JavaOne 2017
Best Practices for Managing Docker Versions as presented at JavaOne 2017
 
Troubleshooting & Debugging Production Microservices in Kubernetes as present...
Troubleshooting & Debugging Production Microservices in Kubernetes as present...Troubleshooting & Debugging Production Microservices in Kubernetes as present...
Troubleshooting & Debugging Production Microservices in Kubernetes as present...
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
 
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...
 
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...
 
Let’s Wing It: A Study in DevRel Strategy
 Let’s Wing It: A Study in DevRel Strategy Let’s Wing It: A Study in DevRel Strategy
Let’s Wing It: A Study in DevRel Strategy
 
Log Driven First Class Customer Support at Scale
Log Driven First Class Customer Support at ScaleLog Driven First Class Customer Support at Scale
Log Driven First Class Customer Support at Scale
 
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
 
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...
 

Último

Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 

Último (20)

Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 

Java 8 Puzzlers [as presented at OSCON 2016]

  • 1.
  • 4.
  • 6. 1. Two entertaining guys on stage 2. Funny Puzzling questions 3. You think and vote 4. Awesome t-shirts fly in the air 5. Official twitter handle! JAVA8puzzlers
  • 7.
  • 8. Watching the puzzlers like… #dafaq
  • 9. Everything works (or doesn't) in the latest Java 8 update
  • 10.
  • 12. What will be the output? A. milk/bread/sausage B. milk/bread/sausage/eggs, don’t forget eggs! C. List<String> list = new ArrayList<>(); list.add("milk"); list.add("bread"); list.add("sausage"); Stream<String> stream = list.stream(); list.add("eggs, don’t forget eggs!"); stream.forEach(System.out::println);
  • 13.
  • 14. Late binding, duh… List<String> list = new ArrayList<>(); list.add("milk"); list.add("bread"); list.add("sausage"); Stream<String> stream = list.stream(); list.add("eggs, don’t forget eggs!"); stream.forEach(System.out::println);
  • 15. Late binding, duh… List<String> list = new ArrayList<>(); list.add("milk"); list.add("bread"); list.add("sausage"); Stream<String> stream = list.stream(); list.add("eggs, don’t forget eggs!"); stream.forEach(System.out::println);
  • 17. What will be the output? A. milk/bread/sausage B. milk/bread/eggs, don’t forget eggs! C. milk/bread/ConcurrentModificationException D. ConcurrentModificationException List<String> list = new ArrayList<>(); list.add("milk"); list.add("bread"); list.add("sausage"); list = list.subList(0, 2); //No sausage, please! Stream<String> stream = list.stream(); list.add("eggs, don’t forget eggs!"); stream.forEach(System.out::println);
  • 18.
  • 21. What’s the difference between 1 and 2? A. 1 compiles, 2 does not B. 2 compiles, 1 does not C. Same same, both work fine D. Same same, both won’t compile public void killAll(){ ExecutorService ex = Executors.newSingleThreadExecutor(); List<String> sentence = Arrays.asList("Punish"); ex.submit(() -> Files.write(Paths.get("Sentence.txt"), sentence) ); // 1 ex.submit(() -> { Files.write(Paths.get("Sentence.txt"), sentence); }); // 2 }
  • 23. What’s the difference between 1 and 2? A. 1 compiles, 2 does not B. 2 compiles, 1 does not C. Same same, both work fine D. Same same, both won’t compile public void killAll(){ ExecutorService ex = Executors.newSingleThreadExecutor(); List<String> sentence = Arrays.asList("Punish"); ex.submit(() -> Files.write(Paths.get("Sentence.txt"), sentence) ); // 1 ex.submit(() -> { Files.write(Paths.get("Sentence.txt"), sentence); }); // 2 }
  • 24. public void killAll(){ ExecutorService ex = Executors.newSingleThreadExecutor(); List<String> sentence = Arrays.asList("Punish"); ex.submit(() -> Files.write(Paths.get("Sentence.txt"), sentence) ); // 1 ex.submit(() -> { Files.write(Paths.get("Sentence.txt"), sentence); }); // 2 } @FunctionalInterface public interface Runnable { public abstract void run(); } @FunctionalInterface public interface Callable<V> { V call() throws Exception; }
  • 26. How that will work? A. Compilation error B. Runtime Exception C. 3 D. Something else System.out.println( Stream.of(-3, -2, -1, 0, 1, 2, 3).max(Math::max).get() );
  • 27.
  • 28. How about now? A. −3 B. −1 C. 0 D. Something else System.out.println( Stream.of(-3, -2, -1, 0, 1, 2, 3).max(Math::max).get() );
  • 29.
  • 30. How about now? A. −3 B. −1 C. 0 D. Something else System.out.println( Stream.of(-3, -2, -1, 0, 1, 2, 3).max(Math::max).get() );
  • 31. • Math.max(−3, −2) = −2 < 0  −3 < −2, selecting−2 • Math.max(−2, −1) = −1 < 0  −2 < −1, selecting−1 • Math.max(−1, 0) = 0  −1 == 0, keeping−1 • Math.max(−1, 1) = 1 > 0  −1 > 1, keeping−1 • Math.max(−1, 2) = 2 > 0  −1 > 2, keeping−1 • Math.max(−1, 3) = 3 > 0  −1 > 3, keeping−1 Stream.of(-3, -2, -1, 0, 1, 2, 3).max(Math::max).get()
  • 33. What will happen? A.Maps will switch B.Both will become oldSchool C.Both will become hipster D.Really?! That won’t even compile! Map<String, String> oldSchool = initOldSchoolStack(); // oldSchool = {buildTool=maven, lang=java, db=db2} Map<String, String> proper = initHipsterStack(); // proper = {buildTool=npm, lang=javascript, db=elastic} oldSchool.replaceAll(proper::put);
  • 34.
  • 35. void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) V put(K key, V value); Map interface oldSchool.replaceAll(proper::put);
  • 36. void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) V put(K key, V value); Map interface final BiFunction<String, String, String> function = (key, value) -> proper.put(key, value); for (Map.Entry<String, String> entry : oldSchool.entrySet()) entry.setValue(function.apply(entry.getKey(), entry.getValue()));
  • 37. void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) V put(K key, V value); Map interface final BiFunction<String, String, String> function = (key, value) -> proper.put(key, value); for (Map.Entry<String, String> entry : oldSchool.entrySet()) entry.setValue(function.apply(entry.getKey(), entry.getValue()));
  • 38.
  • 39. How many lines will be the same? List<String> kitties = Arrays.asList("Soft", "Warm", "Purr"); Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder()); System.out.println(Collections.max(kitties, kittiesComparator)); System.out.println(kitties.stream().collect(Collectors.maxBy(kittiesComparator)).get()); System.out.println(kitties.stream().max(kittiesComparator).get()); A.All lines the same B.Two lines the same C.All different D.Four different
  • 40.
  • 41. How about now? List<String> kitties = Arrays.asList("Soft", null, "Purr"); Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder()); System.out.println(Collections.max(kitties, kittiesComparator)); System.out.println(kitties.stream().collect(Collectors.maxBy(kittiesComparator)).get()); System.out.println(kitties.stream().max(kittiesComparator).get()); A.All lines the same B.Two lines the same C.All different D.Four different
  • 42.
  • 43. How about now? List<String> kitties = Arrays.asList("Soft", null, "Purr"); Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder()); System.out.println(Collections.max(kitties, kittiesComparator)); System.out.println(kitties.stream().collect(Collectors.maxBy(kittiesComparator)).get()); System.out.println(kitties.stream().max(kittiesComparator).get()); A.All lines the same B.Two lines the same C.All different D.Four different
  • 44. List<String> kitties = Arrays.asList("Soft", null, "Purr"); Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder()); System.out.println(Collections.max(kitties, kittiesComparator));
  • 45. List<String> kitties = Arrays.asList("Soft", null, "Purr"); Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder()); System.out.println(kitties.stream().collect(Collectors.maxBy(kittiesComparator)).get());
  • 46. List<String> kitties = Arrays.asList("Soft", null, "Purr"); Comparator<String> kittiesComparator= Comparator.nullsLast(Comparator.naturalOrder()); System.out.println(kitties.stream().max(kittiesComparator).get());
  • 49. How to cast to a type without declaring it? interface Cat{ default void meow() {System.out.println(”meow ");}} interface Dog{ default void bark() {System.out.println(”woof ");}} public static void main(String[] args) { class Dogcatimplements Dog, Cat{} test(new Dogcat()); } static void test(Object obj) { def x = (?)obj; x.meow (); x.bark (); }
  • 50. How to cast to a type without declaring it? static void test(Object obj) { // A. Will that work? Dog& Catx = (Dog& Cat) obj; x.meow (); x.bark (); } static void test(Object obj) { // B. Will that work? ((Consumer<? extends Dog& Cat>)(x -> { x.meow (); x.bark (); })).accept((Dog& Cat)obj); } static void test(Object obj) { // C. Will that work? Optional.of((Dog& Cat) obj) .ifPresent(x -> { x.meow (); x.bark (); });} // D. You’re two sick bastards. interface Cat{ default void meow() {System.out.println(”meow");}} interface Dog{ default void bark() {System.out.println(”woof");}} public static void main(String[] args) { class Dogcat implements Dog, Cat{} test(new Dogcat()); }
  • 51.
  • 52. How to cast to a type without declaring it? static void test(Object obj) { // A. Will that work? Dog & Cat x = (Dog & Cat) obj; x.meow(); x.bark(); } static void test(Object obj) { // B. Will that work? ((Consumer<? extends Dog & Cat>)(x -> { x.meow(); x.bark(); })).accept((Dog & Cat)obj); } static void test(Object obj) { // C. Will that work? Optional.of((Dog & Cat) obj) .ifPresent(x -> { x.meow(); x.bark(); });} // D. You’re two sick bastards. interface Cat{ default void meow() {System.out.println(”meow");}} interface Dog{ default void bark() {System.out.println(”woof");}} public static void main(String[] args) { static class Dogcat implements Dog, Cat{} test(new Dogcat()); }
  • 53. Bill Gates explains how that works
  • 54. static void test(Object obj) { // C. Will that work? Optional.of((Dog & Cat) obj) .ifPresent(x -> { x.meow(); x.bark(); });}
  • 55.
  • 56. Viktor Gamov and Baruch Sadogursky call customer service:
  • 57. What will be the output? 1. HOTEL ECHO LIMA LIMA OSCAR/ HOTEL ECHO LIMA LIMA OSCAR 2. HELLO / HOTEL ECHO LIMA LIMA OSCAR 3. HOTEL ECHO LIMA LIMA OSCAR/ HELLO 4. HELLO/HELLO public class Test { String str; void run() { str = "hello "; Supplier<String> s1 = str::toUpperCase; Supplier<String> s2 = () -> str.toUpperCase(); str = "Hotel Echo Lima Lima Oscar "; System.out.println(s1.get()); System.out.println(s2.get()); } }
  • 58.
  • 59. What will be the output? 1. HOTEL ECHO LIMA LIMA OSCAR/ HOTEL ECHO LIMA LIMA OSCAR 2. HELLO / HOTEL ECHO LIMA LIMA OSCAR 3. HOTEL ECHO LIMA LIMA OSCAR/ HELLO 4. HELLO/HELLO public class Test { String str; void run() { str = ”hello"; Supplier<String> s1 = str::toUpperCase; Supplier<String> s2 = () -> str.toUpperCase(); str = ”Hotel Echo Lima Lima Oscar"; System.out.println(s1.get()); System.out.println(s2.get()); } }
  • 60.
  • 61. What will happen? 1. ConcurrentModificationException 2. ArrayIndexOutOfBoundsException 3. NullPointerException 4. No exceptions, all good List<String> list = new ArrayList<>(Arrays.asList("Arnie", "Chuck", "Slay")); list.stream().forEach(x -> { if(x.equals("Chuck")) { list.remove(x); } });
  • 62.
  • 63. Java 8 vs Chuck Norris
  • 64. What will happen? A. ConcurrentModificationException B. ArrayIndexOutOfBoundsException C. NullPointerException D. No exceptions, all good List<String> list = new ArrayList<>(Arrays.asList("Arnie", "Chuck", "Slay")); list.stream().forEach(x -> { if(x.equals("Chuck")) { list.remove(x); } });
  • 65. Here’s why: stream().forEach()  spliterator().forEachRemaining() forEachRemaining checks for mod count once, in the end Removing element adds null to the end of the array: ["Arne", "Chuck", "Slay"]  ["Arne", "Slay", null] On the last iteration if(null.equals("Chuck")) fails with NPE (didn’t get to CME) Use list.removeIf("Chuck"::equals);
  • 66.
  • 67.
  • 68. System.out.println(Optional.of("rtfm").orElseGet(null)); System.out.println(Optional.empty().map(null).orElse("rtfm")); What will be the output? A.rtfm / rtfm B.rtfm / NullPointerException C.NullPointerException / NullPointerException D.NullPointerException / rtfm
  • 69.
  • 70. System.out.println(Optional.of("rtfm").orElseGet(null)); System.out.println(Optional.empty().map(null).orElse("rtfm")); What will be the output? A.rtfm /rtfm B.rtfm / NullPointerException C.NullPointerException / NullPointerException D.NullPointerException / rtfm
  • 71.
  • 72.
  • 73.
  • 75. - Write readable code! - Comment all the tricks - Sometimes it’s a bug - Static code analysis FTW - intellij IDEA! - Rtfm - Don’t abuse lambdas and streams!
  • 76. - Trust us, we have much more where those came from. - Puzzlers? Gotchas? Fetal position inducing behavior? - puzzlers jfrog.com
  • 77. Did you like it? Praise us on twitter and in the feedback form! - java8puzzlers - gamussa - jbaruch Didn’t like it? /dev/null

Notas del editor

  1. The Car Show (1977-2012) Click and Clack, the Tappet Brothers - Tom and Ray Magliozzi
  2. CURRENT – JB NEXT - FRED
  3. CURRENT – JB NEXT - FRED
  4. CURRENT – YOAV NEXT - JB
  5. CURRENT – YOAV NEXT - JB
  6. Если не добавить throws IOException то оба не компилируются
  7. Если не добавить throws IOException то оба не компилируются