Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
concatenation of an int to a string coerces to a string
Can someone explain why this would work?
didnt they want the answer in string format?
I didnt know that we can initialize variables while calling function. Thanks !!!
Thank you 🙂 The "IntStream.iterare(int seed, IntUnaryOperator operator)" returns an infinite sequential ordered IntStream produced by iterative application of the provided IntUnaryOperator. The seed is the initial element of the iteration.
So basically, it created an infinite stream, starting with the seed, using the IntUnaryOperator operation (+1,-5,etc.) on each element i, to create this infinite sequential stream. The limit is to cancel the 'infinite' part, otherwise it'd be an infinite loop. Then it gets converted to an array.
This is a cool, solution. I am guessing i becomes n, and the iterate method returns the iterator, so it runs once and then adds the number to the array?