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.
This comment is hidden because it contains spoiler information about the solution
Nice touch keepeng the parameter immutable.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Functional programming is a huge topic. The syntax demands some time to get used to it and it's ok to be confused.
In short this code converts ArrayList to a special object Stream. Stream has a lot of different methods, one of them is reduce(), used here. This method accepts functional interface called BinaryOperator.
What we actually trying to do here is to "declare" something we want to do, leaving Java do all the magic under the hood, rather than implementing it by ourselves.
Yes, thank you. It's amazing how one task can be solved differently with functional programming.
Powerful tool.
Friendly advice: use only english for variables naming.
Method signature should be public static int nearestSq(int n). Please add static modifier and type of parameter, otherwise it's confusing for newcomers.
Because it is addressed like to static in tests =(
Java:
class AgeDiff should not have 'static' modifier.
In Java method names should start with lowercase letters.
String is a class and should start with a capital 'S'.
Also, method is declared static, but in tests is accessed using AgeDiff instance. It's weird, so method should not be static also.
Now: public static string CalculateAge(int birth, int yearTo)
Should be: public String calculateAge(int birth, int yearTo)
In Java method names should start with lowercase letters.
Now: public static List CreateList(int number)
Should be: public static List createList(int number)
Cheers!
This comment is hidden because it contains spoiler information about the solution
Latvian should be "Laipni lūdzam!". Cheers!
Brutal coding :D