takeWhile dropWhile Java 9 limit sorted streams #17

takeWhile dropWhile Java 9
takeWhile dropWhile Java 9

Learn deeply concepts from Java core and improve your code quality! Do you know how constructors, static block and instance block behave? Find out on this Java Challenger! Remember, the better you know Java the better your code will be!

Written by
Rafael del Nero
Join the discussion

2 comments
  • Hi Rafael,
    OK. Now I almost understand dropWhile and takeWhile but my question is :
    What is the aim of those methods ?
    I which use case are they useful ? I really don’t see why I would use one of these 2 stream methods

    • Hi Coffi, good question! A possible use case would be when we return a sorted list of a domain object and want to take or drop elements while performing some action on them. Keep doing the challenges!

Stand Out as a Java Developer and Get Your Dream Job!

You will get the book by email in a few minutes after registering.