Skip to content

Instantly share code, notes, and snippets.

View mesketh's full-sized avatar
🙆‍♂️
Services Australia - myGov

Mark Hesketh mesketh

🙆‍♂️
Services Australia - myGov
  • Crestwood, NSW, Australia
View GitHub Profile
public record RecordA(String id) { }
public record RecordB(String id, String name) { }
@Test
public void testFilteringRecordAListWithIdsNotFoundOnRecordBList() {
final Mono<List<RecordA>> recordAMonoList = Mono.just(
List.of(new RecordA("1"), new RecordA("2"), new RecordA("3"), new RecordA("4")));
final Mono<List<RecordB>> recordBMonoList = Mono.just(
List.of(new RecordB("1", "Record 1"), new RecordB("2", "Record 2")));
public record RecordA(String id) { }
public record RecordB(String id, String name) { }
@Test
public void testComparingTwoDifferentReactiveCollectionsOnMatchingAttribte() {
final Mono<List<RecordA>> recordAMonoList = Mono.just(
List.of(new RecordA("1"), new RecordA("2"), new RecordA("3")));
final Mono<List<RecordB>> recordBMonoList = Mono.just(
List.of(new RecordB("1", "Record 1"), new RecordB("2", "Record 2")));
@mesketh
mesketh / Lipu-example
Created November 12, 2024 07:21
comparing two different collections on common attribute reactively.
@Test
public void testComparingTwoDifferentReactiveCollectionsOnMatchingAttribte() {
final Mono<List<RecordA>> recordAMonoList = Mono.just(
List.of(new RecordA("1"), new RecordA("2")));
final Mono<List<RecordB>> recordBMonoList = Mono.just(
List.of(new RecordB("1", "Record 1"), new RecordB("2", "Record 2")));
recordAMonoList.zipWith(recordBMonoList).map(this::compareAndFilterLists).subscribe(
System.out::println, System.err::println, () -> System.out.println("Done")
@mesketh
mesketh / java
Created July 6, 2022 02:29
KafkaMetaAdder-example-post-processor
/*
* Copyright 2008-present MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="GoogleStyle">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
@mesketh
mesketh / AppConfig.java
Created March 28, 2022 23:10
example percentiles - spring boot
package org.eclipse.jkube.maven.sample.spring.boot;
import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.Histogram;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
@Configuration
@mesketh
mesketh / PaymentTxn.java
Created February 26, 2020 01:03
Judy - this is what i've implemented.
String usernamePrefix =
box.getEnv().getUsername().toUpperCase().replaceAll("[^a-zA-Z0-9]", StringUtil.EMPTY_STRING);