As always, now i feel terrible for my 100 lines solution. Not that I was going for simple, but I do wish I knew more about this functional programming thingy. it's so more concise and easy to read.
It's run a predicate against number that first converted to string. Predicate is an interface with single method boolean test(T object) (T is a String in this case).
With Stream.of(...) we creates a stream of predicates. And with anyMatch(...) we test each predicate if it's returns true for incoming number.
Nice one :)
As a little improvements :
Like this one so much!
How does Stream.<Predicate>of() work? Is it casting the output of the method?
As always, now i feel terrible for my 100 lines solution. Not that I was going for simple, but I do wish I knew more about this functional programming thingy. it's so more concise and easy to read.
Hi Klesmus,
Can you please look at some comments above regarding the Java version?
You can install TestNG in Eclipse but I would be mindful of the fact, that its a pain to keep separate from Junit.
It's run a predicate against number that first converted to string. Predicate is an interface with single method
boolean test(T object)
(T is a String in this case).With
Stream.of(...)
we creates a stream of predicates. And withanyMatch(...)
we test each predicate if it's returns true for incoming number.can somone explain me what does p.test(Integer.toString(number)) ?
So beautiful, I love it!
I am in awe.
This is beautiful! It's the same approach I was going for, but it's 1/4 the size!
Raised https://github.com/Codewars/codewars-runner-cli/issues/182
Godlike!
Marking suggestion as resolved.
Java translation has been approved.
Loading more items...