This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val input = listOf(12000, 1000, 12000, 25000, 12000, 15000, 12000, 35000) | |
with(input.sorted().reversed()) { | |
input.map { "$it => ${indexOf(it) + 1}" } | |
}.forEach(::println) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static java.util.stream.Collectors.joining; | |
import java.util.stream.IntStream; | |
public class QuarterlyMonths { | |
public static String get(int input) { | |
final int offset = (input % 3) == 0 ? 3 : (input % 3); | |
return IntStream.range(0,4).mapToObj(i -> String.format("%02d", i * 3 + offset)).collect(joining()); | |
} | |
//To test the `get` method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.function.Consumer; | |
import java.util.function.Supplier; | |
import io.vavr.Tuple; | |
import io.vavr.Tuple2; | |
import io.vavr.collection.Stream; | |
import io.vavr.control.Option; | |
import io.vavr.control.Try; | |
public class FunctionalRetry { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sort -k1.1,1.4 -k1.11,1.13 |