Exploring Collectors by Venkat Subramaniam

  Рет қаралды 79,969

Devoxx

Devoxx

Күн бұрын

Пікірлер: 73
@CostaKazistov
@CostaKazistov 4 жыл бұрын
Venkat is phenomenal teacher. Of all Java speakers on KZbin, he is my favourite. I've been watching his talks since about 2015. In many ways his style of teaching is even better than most online courses.
@kennethsizer6217
@kennethsizer6217 3 жыл бұрын
Totally agree!
@tibettenballs4962
@tibettenballs4962 2 жыл бұрын
Don’t forget about his recent arrest, for (I believe so don’t quote me) having naughty child pictures.
@thepeerdependency
@thepeerdependency 2 жыл бұрын
@@tibettenballs4962 Where did you hear about this??
@snowy0110
@snowy0110 4 жыл бұрын
Everybody likes Venkat
@orlovskyconsultinggbr2849
@orlovskyconsultinggbr2849 4 жыл бұрын
Yeah but one person not ;)
@sankarpandiarajan5808
@sankarpandiarajan5808 4 жыл бұрын
Saw a comment in another of Venkat's talks..."the best stand-up comedian". he absolutely is...amazing how effortlessly he walks over such complex stuff. the mutant jaws...creating a new species with "mapFlattening" vs "flatMap" - man!!! hilarious.
@skootdiggity1301
@skootdiggity1301 3 жыл бұрын
Oracle should add an honorary Yeeinteger class for Venkat.
@monsterhuntergo
@monsterhuntergo 2 жыл бұрын
I'm now a fan... I just started following him and a nice way to update my skills too. Functional programming is in-line with clean coding as well. Thanks so much for sharing.. Hope to have more of your videos.. Hope there are also updated videos of him.. :)
@anversadhat760
@anversadhat760 3 жыл бұрын
"Haskel feels like Cathedral and Java is like Bazzar" :) 17:00 "It works" 21:45
@ruixue6955
@ruixue6955 3 жыл бұрын
51:42 motivation of groupingBy 51:56 imperative way of grouping - 52:11 question to resolve 57:00 groupingBy
@ErfanHossainShoaib
@ErfanHossainShoaib 4 жыл бұрын
One word for you, "Eloquent". Thank you Sir.
@ricardotrejoruiz5776
@ricardotrejoruiz5776 2 жыл бұрын
The golden conference everybody need to watch.
@asakchris
@asakchris 4 жыл бұрын
Venkat - YOU ARE THE BEST!!!
@RaviNagubandi
@RaviNagubandi 4 жыл бұрын
Terrific session. Venkat is master
@nguyenquan4836
@nguyenquan4836 Жыл бұрын
Very fun when he talk about flat map. Thank sir
@techpatil524
@techpatil524 4 жыл бұрын
My favorite guy, best thing i learn from him👌
@nitinagrawal6637
@nitinagrawal6637 4 жыл бұрын
In the last 1 hour of this talk, I feel that I was looking at the complex or messy part of such functional programming. So, as Venkat says 'Once you get used to it...', it reminded me his earlier statement about the difference between simple & familiar. So after doing such functional programming, it becomes familiar & not simple...I think. I think one needs to have very fine balance between usage of Functional & Imperative programming to keep things simple & not just familiar. And if such stuffing goes on in Functional programming, then I fear that another Venkat will be giving lectures to use Imperative programming to get rid of complexities in Functional programing. Too much purity or Immutability, also sucks while doing programming. Please let me know if you have other thoughts to correct me.
@nO_d3N1AL
@nO_d3N1AL 4 жыл бұрын
I agree. The groupingBy example with the nested Collectors is barely understandable for people familiar with the Streams API, let alone someone that's used to imperative style. Honestly in that case the imperative code is easier to work with, at least you can see what it's doing line-by-line/per-instruction explicitly without having to figure out the method signatures from documentation. The functional code is less understandable in that case because it hides the signatures and assumes you know the API and its semantics, whereas imperative code makes it clear what the interactions are. Oh and good luck debugging lambdas in streams / collectors. Admittedly however one can temporarily convert them to AICs using the IDE and convert them back after.
@truth-7380
@truth-7380 3 жыл бұрын
Venkat made it indeed too complex, because he just loosed the orientation in the stream API: if you want to get the name of the oldest Person: String nameOfOldestPerson = Person.getPersonList().stream() .max(Comparator.comparing(Person::getAge)) .map(Person::getName).orElse("Oldest not found"); It is a matter of training to become familiar with the Stream API and in that case you will be able to pick the easiest syntax to get your job done.
@juansebastiangonzalezlopez9119
@juansebastiangonzalezlopez9119 Жыл бұрын
Goosebumps & speechless
@peter.g6
@peter.g6 4 жыл бұрын
One minor correction, the term "idempotent function" means something different - it means applying the function on a result it gives yields again the same result. Sorting is a good example - if you have a list and you sort it, it can change, but if you sort it again, it stays the same.
@CostaKazistov
@CostaKazistov 4 жыл бұрын
Thanks for clarification. I was confused when Venkat said that about idempotent function, as I remember the definition being exactly as you described.
@BryanEaton
@BryanEaton 4 жыл бұрын
This guy is awesome
@anushasanpoudel3034
@anushasanpoudel3034 3 жыл бұрын
what a legend Venkat is !
@ganga5809
@ganga5809 3 жыл бұрын
From 🇳🇵?
@anushasanpoudel3034
@anushasanpoudel3034 3 жыл бұрын
@@ganga5809 yes !
@amazingvipul8392
@amazingvipul8392 4 жыл бұрын
Awesome talk Venkat.
@mangeshpawar2255
@mangeshpawar2255 4 жыл бұрын
Excellent explanation of stream collectors
@RobinsonGames
@RobinsonGames 5 жыл бұрын
This was really cool
@truth-7380
@truth-7380 3 жыл бұрын
Here is how to get the oldest Person in every City: (value = Optional) Map oldestPersonByCity = Person.getPersonList().stream() .collect( groupingBy(Person::getCity, maxBy(comparing(Person::getAge))));
@satyanarayanmohanty3415
@satyanarayanmohanty3415 4 жыл бұрын
A true Guru.
@amazingvipul8392
@amazingvipul8392 4 жыл бұрын
mapFlatten to flatMap reasoning was hilarious :D
@mehmoodrehman6336
@mehmoodrehman6336 2 жыл бұрын
1. Java and Functional Programming 0:00 a. Lazy evaluation vs eager evaluation 2. Common operations: filter 2:00, map 5:50, reduce 6:20 3. Functions should be pure 4. Avoid shared mutability 5. A little example …gone wrong 6. The right way, - delegate, be declarative, 7. collect is a reduce operation 8. Collectors utility class 9. toList, toSet 30:00 10. Should we not honor immutability? leave it to the APIs
@sushantkumarrout2198
@sushantkumarrout2198 Жыл бұрын
Sir you are just awesome
@truth-7380
@truth-7380 3 жыл бұрын
This is how get the name of the oldest Person with one statement: No NEED for collect(), no need for maxBy(), no need for collectingAndThen(). String nameOfOldestPerson = Person.getPersonList().stream() .max(Comparator.comparing(Person::getAge)) .map(Person::getName).orElse("Oldest not found"); Sometimes Venkat exaggerate a little bit :-)
@B-Billy
@B-Billy 4 жыл бұрын
58:35 CameraMan is also lazy like Java Streams :)
@eldiosdelcielo
@eldiosdelcielo 8 ай бұрын
Long live Venkat
@silvere4830
@silvere4830 2 жыл бұрын
Venkat is THE master
@rydmerlin
@rydmerlin Жыл бұрын
How is teeing() different from reducing()?
@ramachari1975
@ramachari1975 4 жыл бұрын
It is excellent. No doubt about that. But, how is he able to print directly from groupingBy / partioningBy without iterating as (K,V) it returns map..Any pointers, please?
@MrMikomi
@MrMikomi 3 жыл бұрын
Map has toString I think which works for wrappers or strings (I'm away from keyboard so not definite)
@ShinAkuma
@ShinAkuma Жыл бұрын
Java can print collections directly as they all have a toString method. However if you have a collection of Primitives, then it will print the hashcode insted and in that case u need to iterate manually.
@bmiguelmf
@bmiguelmf 4 жыл бұрын
My code hero!!!
@dcngn_
@dcngn_ 3 жыл бұрын
Man I learned to love streams, but I know how it felt like to see them when I haven't learned about them yet.. I wonder how my supervisor will feel like when he sees my thesis full of streams.
@jaimealbertoobispooscco173
@jaimealbertoobispooscco173 4 жыл бұрын
Fantastic.
@nitinagrawal6637
@nitinagrawal6637 4 жыл бұрын
I hear Venkat & really like his talks..but...but...The kind of Lazy Evaluation, he talks I see it as how the creators of such APIs want & write. The APIs which are marked as Lazy, are being termed as intermediate functions as he told himself & eager functions are Terminal ones as he told that also. So, intermediate functions are not supposed to be executed till Terminal function is called i.e. till this point the intermediate functions are being stacked only. And I say this as purely 'Postponing the actions' & it is smart way also, but not a lazy one. For example - When you need to purchase some item from the market & you don't need that right now, then you keep noting such items in a list. And when you see that you have sufficient number of items to buy from the market then you get out to buy them, so if you think such behavior as 'Lazy' one then can say it, else for me it is a smart decision to postpone certain actions till the right moment comes. But a lazy person, will be buying these items & may be not all or may be at his/her speed or may be not at the right time. So what is 'Lazy' in the definition given by Venkat, when these functions are not allowed to execute. These functions would have been lazy when they are allowed to execute immediately but still will execute only when they like. It is like, someone tie you with rope & then tag you saying that you are lazy & don't do any work.
@pn4684
@pn4684 4 жыл бұрын
Lazy loading is a term used for deferred initialization/run. It is used in other languages, dbs and scripts too. It is not a new term coined just for streams here. It does sound a bit funny the way you put it though.
@codewithshadab
@codewithshadab 4 жыл бұрын
Great sir.. Can tell me what IDE you used??
@nitinagrawal6637
@nitinagrawal6637 4 жыл бұрын
As shown in this video, I think he is using 'TextMate'
@johnykumar1141
@johnykumar1141 4 жыл бұрын
You're right..
@mohitchandra5632
@mohitchandra5632 4 жыл бұрын
I was trying reduce Operation and i saw when i turned it to parallel stream it started giving error so i believe we cannot use parallel streams for reduce for the exampe mentioned at kzbin.info/www/bejne/pnjVoItpnNKYhpo .
@kookoon
@kookoon 4 жыл бұрын
@1:26:47 Java becoming Lisp
@USONOFAV
@USONOFAV 4 жыл бұрын
Is grouping by in java 8?
@nO_d3N1AL
@nO_d3N1AL 4 жыл бұрын
yes
@dmitriypronichev7048
@dmitriypronichev7048 3 жыл бұрын
omg, how can he speak so much without pauses :)))))
@JatinderSingh-is7gw
@JatinderSingh-is7gw 2 жыл бұрын
True statement Paul is missing 23:12. People really missing Apostle Paul and are lost.
@truth-7380
@truth-7380 3 жыл бұрын
The lovely Venkat does not make the difference between max() and maxBy(). The example with maxBy() is not good at all. You can do the same with max(): people.stream().max(comparator) and the rest of the statement is not good programming at all. It seams that Venkat is trying to make an example with maxBy by any means. After a goggle search, it seams that the most people do not know good use cases for maxBy() and in almost all examples it was clear, that it is possible to use max(comparator) instead of collect(maxBy()) with surely les verbose code.
@nO_d3N1AL
@nO_d3N1AL 4 жыл бұрын
Venkat is always enthusiastic, but IMO he could've easily skipped the first 40 minutes since it was a basic refresher on Streams.
@anudeepgrandhi4988
@anudeepgrandhi4988 4 жыл бұрын
Super sir
@marweck
@marweck 4 жыл бұрын
What is the fastest Java implementation of Collections used these days? Eclipse (former Goldman Sachs) collections, Guava collections? Any other famous implementation?
@snowy0110
@snowy0110 4 жыл бұрын
tl,dr: imo, one should not strive to find the fastest collection implementation library if performance is not your direct job. I believe every implementation you mentioned is fast enough. The fastest one depends on hardware, running OS, implementation of JVM, kind of input data and Collections implementation. This basically means that if you want to see a real impact of having the fastest collection in your particular case, you need to write your code using interfaces and make an experiment for exactly your case: your hardware, your os, your JVM, your input data, and test several collection implementations. Only this way you can be sure that you've chosen the fastest (for your particular case). Disclaimer: I had a subject in a university when I was given a task to implement several searching algorithms for finding a substring in text. Back in those days, I was inexperienced just like my friends. Our instructor was a deeply theoretical man who decided to check our code by running performance tests. Based on benchmarks he wanted to check that our code was implemented correctly. We didn't believe our eyes when the same exact code showed completely different results on different machines. Moreover, sometimes, the same algorithm showed completely different results launched several times in a row. Sadly, the instructor didn't believe us and we were forced to fake the results by adding hackish "Thread.sleeps" just to pass the exam. Only later I had a class about computer architecture and realized what was going on. I finished my studies 5 years ago.
@pn4684
@pn4684 4 жыл бұрын
Totally agree. And not to forget the randomness in the collection. Some algorithms are great when there some orderliness in the elements (even if not completely ordered) and some work better in scenarios where randomness is more.
@LUQMAN72
@LUQMAN72 5 жыл бұрын
what are the features that are available in java 8?
@pn4684
@pn4684 4 жыл бұрын
This is the exhaustive list. www.oracle.com/java/technologies/javase/8-whats-new.html
@amidfallen
@amidfallen 2 жыл бұрын
"Brian is overloaded" ... lol xD 1:10:20
@plreuokjhg
@plreuokjhg 3 жыл бұрын
2hrs 😱
Java 9 and Beyond by Venkat Subramaniam
2:39:02
Devoxx
Рет қаралды 31 М.
Как не носить с собой вещи
00:31
Miracle
Рет қаралды 1 МЛН
怎么能插队呢!#火影忍者 #佐助 #家庭
00:12
火影忍者一家
Рет қаралды 47 МЛН
НАШЛА ДЕНЬГИ🙀@VERONIKAborsch
00:38
МишАня
Рет қаралды 2,8 МЛН
Who’s the Real Dad Doll Squid? Can You Guess in 60 Seconds? | Roblox 3D
00:34
Twelve Ways to Make Code Suck Less by Venkat Subramaniam
1:00:44
Reactive Programming by Venkat Subramaniam
2:36:06
Devoxx
Рет қаралды 78 М.
Как не носить с собой вещи
00:31
Miracle
Рет қаралды 1 МЛН