Тёмный

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

Java
Подписаться 182 тыс.
Просмотров 63 тыс.
50% 1

Опубликовано:

 

7 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 73   
@svalyavasvalyava9867
@svalyavasvalyava9867 2 года назад
I like these videos sooo much. They are infinitely nice to watch. Thank you!
@java
@java 2 года назад
Glad you like them!
@BangsarRia
@BangsarRia 27 дней назад
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.
@adrianperez8695
@adrianperez8695 2 года назад
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.
@JosePaumard
@JosePaumard 2 года назад
Thank you! Glad you like it!
@bikramdhall1266
@bikramdhall1266 2 года назад
Sir, I am a big fan (as student) of you since couple of years . Thanks a lot.
@java
@java 2 года назад
So nice of you!
@GercioP
@GercioP 2 года назад
You are Magician of Java Streams 😄
@hessenbenslima
@hessenbenslima 2 года назад
Thank you so mush Mr. Paumard great presentation
@java
@java 2 года назад
You are very welcome
@pravinjain2834
@pravinjain2834 2 года назад
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.
@n_lisper
@n_lisper 11 месяцев назад
Thanks for the info, didn’t know about this!
@thoaikieu5707
@thoaikieu5707 8 месяцев назад
hello ! can you give me example supplementary characters which may be alphabetic.
@MakeItStik
@MakeItStik 2 года назад
Jose, We need such videos more frequently !
@java
@java 2 года назад
We agree! Please stay tuned and hit the 🔔 to get notified. 😉
@VisruthCV
@VisruthCV 2 года назад
Very useful video, thanks for publishing!
@JosePaumard
@JosePaumard 2 года назад
Thank you!
@VisruthCV
@VisruthCV 2 года назад
@@JosePaumard Welcome
@stevenpereira8537
@stevenpereira8537 2 года назад
Thanks for posting. Great explanation and breakdown!
@java
@java 2 года назад
Glad you enjoyed it!
@victorpinasarnault9135
@victorpinasarnault9135 2 года назад
Finally, java tutorials ❤
@HerbertLandei
@HerbertLandei 2 года назад
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.
@aswarthanarayanareddyb176
@aswarthanarayanareddyb176 2 года назад
Awesome sir.
@nithinnambiar
@nithinnambiar 2 года назад
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.
@canbariscan
@canbariscan 9 месяцев назад
music gets real good at 19mins :)
@MT________
@MT________ Год назад
This would look so much nice in Java Xtend. Sadly though that language never really had a breakthrough.
@ericandresen680
@ericandresen680 2 года назад
Holy cow that is a lot of code... Starting to use Go, and now i remember why :D
@MakeItStik
@MakeItStik 2 года назад
Can you paste some Go code here for the 2nd problem - top occurrences (including case of tie as described) ? Will help in comparing. - you can mention a github link.
@badpotato
@badpotato 2 года назад
really good videos.. thanks.
@artemmishin800
@artemmishin800 2 года назад
Great 👍 thanks Jose))) best lessons!!
@java
@java 2 года назад
Glad you liked it!
@yohanal33
@yohanal33 2 года назад
Good Job again
@rokkralj9786
@rokkralj9786 Год назад
There is a much simpler solution. 1. Group by letter to get counts Map, 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.
@youshasajjad5402
@youshasajjad5402 Год назад
Thanks for the videos. It will surely help me.
@olayemimichael3426
@olayemimichael3426 2 года назад
Thanks, Java is cool
@marcelmfa
@marcelmfa Год назад
Do you have any video showing how you did to get data benchmark data?
@fabricioaraujo7642
@fabricioaraujo7642 2 года назад
Thanks !
@EskilP
@EskilP 7 месяцев назад
mmmhmm cold coffee 😛
@csvxmlfan3853
@csvxmlfan3853 2 года назад
Where can I get such a beautiful mug?
@SLTRM
@SLTRM 2 года назад
Snake case in class method names? Mmmm maybe too much pressure from rust lang? Je je je
@ramdaneoualitsen1323
@ramdaneoualitsen1323 2 года назад
There is an issue with the ide. it is not in dark mode.
@BangsarRia
@BangsarRia 27 дней назад
But were you able to watch the video? I doubt I'm the only one who wouldn't have been able to read the text if in dark mode
@alexhamilton4332
@alexhamilton4332 2 года назад
What does the us in us/op stand for?
@JosePaumard
@JosePaumard 2 года назад
It's the symbol for micro seconds / operation. Usually ou write it "μs", but in many case the "mu" (greek letter) will not display correctly.
@ClevertonHeusner
@ClevertonHeusner 2 года назад
Nice. Now pour me a drink, please.
@java
@java 2 года назад
Deal
@aharonha
@aharonha 2 года назад
Seems like someone in eclipse collections project is working hard to solve a non-existing problem.
@weho_brian
@weho_brian 2 года назад
Java is still around? JavKidding
@themrambusher
@themrambusher Год назад
jdk17 code is more complex than jdk8 code in my opinion
@houssamel1657
@houssamel1657 2 года назад
Is this person from France 🇫🇷?
@JosePaumard
@JosePaumard 2 года назад
I am.
@houssamel1657
@houssamel1657 2 года назад
@@JosePaumard Yeah, I inferred that from how you pronounce letters, thanks for this wonderful video.
@JosePaumard
@JosePaumard 2 года назад
@@houssamel1657 Thank you, glad you like it!
@Anshulkatta
@Anshulkatta Год назад
Netherlands or Denmark most probably
@francoisloriot2674
@francoisloriot2674 4 месяца назад
​@@Anshulkattanot at all. this is a french accent for sure 😊
@cod3r1337
@cod3r1337 2 года назад
Still mind-boggingly verbose and clunky for something that should be simple. And that's for code written by a very experienced, very smart expert, doing everything that can reasonably be done with the latest tools available to distill it down to near-optimum readability. Good thing we have Kotlin and Clojure now, otherwise I would probably have given up on the JVM...
@brucedsm
@brucedsm 2 года назад
Can you show a example in kotlin? To compare...
@Inuyasha463
@Inuyasha463 2 года назад
@@brucedsm I can step in here and provide an example. I'm not expert though, so perhaps there are better ways to do it in Kotlin. I haven't watch the whole video yet, so I'm copying the logic he used for the second kata before he started talking about inverting the map. I still need to finish watching that part. The logic should be basically the same as his, so this comparison is mostly so you can compare the readability of Kotlin code with Java code. I personally find it less cluttered and confusing than the Java Streams Apis, but perhaps I'm just more used to Kotlin these days. val result = "This is a test String." .lowercase() .filter { it.isLetter() } .groupingBy { it }.eachCount() .entries.sortedByDescending { it.value } .take(3) The output is: [t=4, s=4, i=3] On a separate note, I love these videos and all the great changes coming to Java. Thanks guys, and keep up the great work!
@ErikBrakkee
@ErikBrakkee Год назад
Perhaps the video should also have shown a basic method using for loops and collections. My guess is that that code would have been a lot shorter and more easy to understand. There are places for streams IMO but the authors of the streams framework probably did not intend to replace all for loops by streams.
@vanivari359
@vanivari359 Год назад
@@ErikBrakkee yeah, once you start to use it, you tend to use it everywhere, but many java developers really struggle to adopt to them because you have to learn so much stuff - all the collectors and comparators and streams and predicates and static method references and the processing order in the background, i mean: Comparator.reverseOrder() .. who is looking there for that. It forces people into stackoverflow-programming (which is fine if you know what you are doing., but..)
@miasmator
@miasmator Год назад
@@vanivari359 You fail to see that Java has already eliminated 90% of the verbosity. Before Java 8, especially before anonymous classes implementing any of this was particularly verbose. Also the fact that you needed to use procedural patterns, any algorithm would have required 100+ lines of code if you didn't want code smells in the form of overly long functions. Having a separate sort method for reverse order might be handy, but these kind of helper methods increase the size of classes and pollute their namespaces.
@cccc2740
@cccc2740 Год назад
Record would kill lombok
@progdynamic3114
@progdynamic3114 2 года назад
he seems to be starving for a long time.
@cya3mdirl158
@cya3mdirl158 2 года назад
Or start using Kotlin
@sandeepthakur7795
@sandeepthakur7795 2 года назад
Will you please improve your voice quality?
@MrJgremmen
@MrJgremmen 7 месяцев назад
you're not used to writing specifications, are you?
@user-zq8bt6hv9k
@user-zq8bt6hv9k 2 года назад
i switched to rust 🙄
@jackofnotrades15
@jackofnotrades15 2 года назад
lol
@user-zq8bt6hv9k
@user-zq8bt6hv9k 2 года назад
@@Ihavetoreturnsomevideotapes then switch to javascript
@Asdasxel
@Asdasxel 2 года назад
@@user-zq8bt6hv9k Why would you want to end up with a worse language that is used in totally different types of applications?
@user-zq8bt6hv9k
@user-zq8bt6hv9k 2 года назад
@@Asdasxel same reason why people switched from c++ to java in the 90's
@adilsheikh9916
@adilsheikh9916 Месяц назад
Tried below way to get the top 2 or 3 etc most occurring characters, to avoid creation of Records- str.chars() .mapToObj(c -> (char)c) // .map(Character::toLowerCase) .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())) .entrySet() .stream() .collect(Collectors.groupingBy(Map.Entry::getValue,Collectors.mapping(Map.Entry::getKey, Collectors.toList()))) .entrySet() .stream() .sorted(Map.Entry.comparingByKey().reversed()) .limit(2) .forEach(System.out::println); Creating Records for such requirements was causing complexity for me. But have measured the performance of above code.
@adilsheikh9916
@adilsheikh9916 Месяц назад
above code is about 10 times slower than the imperative code written in Java & I will prefer imperative code over functional style till there is a very good reason.
Далее
Modern Java - Top Features of Java 9 to 17
20:19
Просмотров 90 тыс.
Mark Rober vs Dude Perfect- Ultimate Robot Battle
19:00
Men Vs Women Survive The Wilderness For $500,000
31:48
Java 21 new feature: Virtual Threads #RoadTo21
33:35
Просмотров 62 тыс.
String Concatenation - JEP Café #7
17:24
Просмотров 9 тыс.
Mark Rober vs Dude Perfect- Ultimate Robot Battle
19:00