Hot.orelse(not)

12
@hypernation @nickvdh #Devoxx #hotornot Hot.orElse(not) Nick Vanderhoven Jeroen Horemans `

Transcript of Hot.orelse(not)

Page 1: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

Hot.orElse(not)Nick Vanderhoven

Jeroen Horemans

`

Page 2: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

String concatenation

• Compiler optimization with

StringBuilder

• “ To increase the performance

of repeated string

concatenation, a Java compiler

_may_ use the StringBuffer

class or a similar technique to

reduce the number of

intermediate String objects that

are created by evaluation of an

expression. ” - JLS

30 % 70 %

HOT NOT

Page 3: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

milli micro nano pico

• nanoTime()

= precision timer

• currentTimeMillis()

= wall clock

• jmh35 % 65 %

HOT NOT

Page 4: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

Streams and state

• never modify the same

list an iterator/stream

• sorted() = “stateful

intermediate

operation”

• breaks with parallel()

• mutable shared

variable

59 % 41 %

HOT NOT

Page 5: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

Primitive constructors

• @Deprecated(since="9

")

public Integer(int value)

• 5 boolean states

• Boolean.TRUE

• Boolean.FALSE

• new Boolean(true)

• new Boolean(false)

• null

32 % 68 %

HOT NOT

Page 6: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

JEP 286: Local-Variable Type Inference

• JEP 286

Feature Candidate

• Author

Brian Goetz

• Reviewed by

Alex Buckley, Mark

Reinhold

72 % 28 %

HOT NOT

Page 7: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

Optional.get()

• “I think calling this

method ‘get()’ was our

biggest API mistake in

Java 8.”

- Brian Goetz

• Optional.getWhenPresent()

?33 % 67 %

HOT NOT

Page 8: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

Lombok

• Developers are lazy,

but don’t trust anything

they don’t understand

• Beyond JSR 269

(annotation

processors)59 % 41 %

HOT NOT

Page 9: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

Exceptions

//no comment

68 % 32 %

HOT NOT

Page 10: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

MATCH

1 award-winning author, founder of Agile Developer, Inc., and an instructional

professor at the University of Houston.

Venkat Subramaniam

76 %

95 %

65 %

FRAMEWORKS

FUNCTIONAL

JAVA

Page 11: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot

Thank you for voting

Nick Vanderhoven

Jeroen Horemans

`

Page 12: Hot.orelse(not)

@hypernation @nickvdh#Devoxx #hotornot