Refactoring Java 8 code with Java 17 new features - JEP Café #9

preview_player
Показать описание
How to use the new features from Java 17, especially Records, to improve your Java 8 code. Do you need to make your code easier to understand without losing performance? This JEP Café shows you how to do it.

Submit your katas for more live coding like this one!

Tags: #Java #OpenJDK #Java17 #JDK #JDK17 #Record #Programming #JEPCafe #InsideJava

⎯⎯⎯⎯⎯⎯ Chapters ⎯⎯⎯⎯⎯⎯
0:00 Intro
1:02 Introducing the Haiku Katas
1:58 1st kata: finding all the letters used in a String
3:37 Comparing the performances
3:53 2nd kata: getting the top 3 most used letters
8:26 Solving the tie problem by inverting a map
12:28 Improving the code with Java 17 features: Records
20:30 Comparing the performances
21:16 3rd kata: partionning the words
22:54 Partionning the words in one pass
23:57 Comparing the performances
24:32 Outro

⎯⎯⎯⎯⎯⎯ Resources ⎯⎯⎯⎯⎯⎯
Рекомендации по теме
Комментарии
Автор

I like these videos sooo much. They are infinitely nice to watch. Thank you!

svalyavasvalyava
Автор

Thank you for these recent series of videos on Java 17 features. I've shared them with my team to help us get up to speed on newer features.

adrianperez
Автор

Sir, I am a big fan (as student) of you since couple of years . Thanks a lot.

bikramdhall
Автор

I keep encountering convoluted problems involving tuples, so this was a nice change from the usual trivial examples. Records made the code much clearer and the code blocks shorter. In a case of mutable data, it will be even more helpful.

BangsarRia
Автор

At 3:15, both the Kata and the JDK 17 solution have a common bug.
the filtering will eliminate supplementary characters which may be alphabetic.
The use of chars() method is the culprit, using codePoints() would be more correct.
The surrogate range 0xd800 0xdfff, will always result in isAlphabetic returning false and will eliminate all the supplementary characters even if they are alphabetic.

pravinjain
Автор

Thank you so mush Mr. Paumard great presentation

hessenbenslima
Автор

Jose, We need such videos more frequently !

MakeItStik
Автор

Very useful video, thanks for publishing!

VisruthCV
Автор

I would avoid sorting entry streams, instead I would rather try to use a TreeMap with an appropriate comparator instead. If you need a sorted map, why not use one? Yes, it is more finicky to construct one using collectors etc., but you eliminate a whole step.

HerbertLandei
Автор

Thanks for posting. Great explanation and breakdown!

stevenpereira
Автор

Nice, Records can improve the readability a lot. It was little too fast for me as it takes some time to read the code and understand.

nithinnambiar
Автор

This would look so much nice in Java Xtend. Sadly though that language never really had a breakthrough.

MT________
Автор

Holy cow that is a lot of code...
Starting to use Go, and now i remember why :D

ericandresen
Автор

There is a much simpler solution.

1. Group by letter to get counts Map<Char, Integer>, sort it by count
2. Get count of the third element in the list, store it into "int boundaryCount"
3. filter(), or even better takeWhile(), with a count >= boundaryCount.

It should be no more than 5 lines of code.

rokkralj
Автор

Thanks for the videos. It will surely help me.

youshasajjad
Автор

Do you have any video showing how you did to get data benchmark data?

marcelmfa
Автор

Snake case in class method names? Mmmm maybe too much pressure from rust lang? Je je je

SLTRM
Автор

There is an issue with the ide. it is not in dark mode.

ramdaneoualitsen
Автор

Seems like someone in eclipse collections project is working hard to solve a non-existing problem.

aharonha
Автор

jdk17 code is more complex than jdk8 code in my opinion

themrambusher