This file contains hidden or 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
| inline fun <T : Any, U : Any> Collection<T>.innerJoin( | |
| with: Collection<U>, | |
| on: (Pair<T, U>) -> Boolean | |
| ): Collection<Pair<T, U>> = map { t -> | |
| val intersection = with.filter { on(Pair(t, it)) } | |
| Pair(t, intersection) | |
| } | |
| .filter { pair -> pair.second.isNotEmpty() } | |
| .flatMap { pair -> pair.second.map { Pair(pair.first, it) } } |
This file contains hidden or 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
| package kjkrol.amqpbroker | |
| import org.apache.qpid.server.SystemLauncher | |
| import org.springframework.amqp.core.BindingBuilder | |
| import org.springframework.amqp.core.TopicExchange | |
| import org.springframework.amqp.rabbit.connection.CachingConnectionFactory | |
| import org.springframework.amqp.rabbit.core.RabbitAdmin | |
| import org.springframework.amqp.rabbit.core.RabbitTemplate | |
| class EmbeddedAMQPBroker { |
This file contains hidden or 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.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import java.util.function.Consumer; | |
| import java.util.stream.Collectors; | |
| import java.util.stream.IntStream; | |
| /** | |
| * @author Karol Krol | |
| */ |
This file contains hidden or 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.Iterator; | |
| import java.util.function.BiFunction; | |
| import java.util.stream.Stream; | |
| import java.util.stream.StreamSupport; | |
| /** | |
| * Zipping streams into parallel or sequential stream using JDK8 with lambda | |
| * | |
| * @author Karol Krol | |
| */ |