Topics

Leave a Reply

22 Comments on "Java 8 Lambda Basics 18 – An Exception Handling Approach"

Notify of
avatar

disekjoumoer
Guest
disekjoumoer
3 days 1 hour ago

You skipped the point of what if the exception is not an ArithmeticException, Very confusing for learners and poor form.

Gaurav Nigam
Guest
Gaurav Nigam
1 month 16 days ago

I watched this video atleast 10 times to understand how the wrapper method is created. One of the best tutorials on Lambda I have seen on you tube. Hats Off to this guy. Explained everything in evolutionary way. Just Brilliant…

Jose Luis Romero
Guest
Jose Luis Romero
1 month 22 days ago

Why do u repeat so many times your explanations?!, it is a video, if someone didn't catch something and wants to hear/watch again and again something, just has to rewind it

kleavenae
Guest
kleavenae
2 months 14 days ago

It would be nice if I could do this:catchSpecificExceptions(Someclass::method, param1, param2);It's equivalent to this:try { Someclass.method(param1, param2);}catch(SpecificException1 e) { dosomething();}catch(SpecificException2 e) { dosomethingelse();}catch(SpecificException3 e) { somethingelse();}But as you can see, it's quite sorter 😀

Yoyo Cob
Guest
Yoyo Cob
3 months 13 days ago

At the end of the video, you mentioned about Generic types, could you write an generic type version of the wrapperLambda function? Thanks a lot. Great Video!!!

Amanuel Alemayehu
Guest
Amanuel Alemayehu
4 months 5 days ago
Thank you! Best tutorial. I wrote the following simple Generic wrapper: import java.util.Arrays;import java.util.List;import java.util.function.BiConsumer; public class LambdaExample{ public static void main(String[] args){ List<Integer> numbers = Arrays.asList(2,3,7,10,9,1,110); int key = 1; process(numbers,key,wrapperConsumer((Integer i,Integer j)-> System.out.println(i/j), ArithmeticException.class)); } private static <T> void process(List<T> values, T key, BiConsumer<T, T> consumer){ values.forEach(i->consumer.accept(i,key)); } private static <T, E extends Exception> BiConsumer<T, T> wrapperConsumer(BiConsumer<T, T> consumer, Class<E> exClass){ return (i,j) -> { try{ consumer.accept(i,j); }catch(Exception e){ E clazz = exClass.cast(e); System.err.println( "Exception Message: " + clazz .getMessage()); } }; }}
livestupid thinkbrilliant
Guest
livestupid thinkbrilliant
5 months 29 days ago

so even now if the operation is changed and if some other exception happens then it will not be handled and it will be thrown as Unhandled exception… what is the point of wrapper without generic exception being caught..

dhananjay patade
Guest
dhananjay patade
6 months 2 days ago

Nice video,, feel like AOP of java 🙂

Narayan Sampath
Guest
Narayan Sampath
6 months 6 days ago

now my company people will have even more complex looking hard to understand programs to look at unless they move to 1.8 beast mode… ha ha

Anurag Kumar
Guest
Anurag Kumar
7 months 5 days ago

Thanks a lot. Appreciate your effort to bring this to us:)

wpDiscuz