MapValue filtered = fields.filter( ( k, ignore ) -> !k.equals( "microsecond" ) && !k.equals( "nanosecond" ) ); return mapFunction.apply( filtered, newTemporal ); int newNanos = validNano( null, micros, nanos ); TEMP newTemporal = (TEMP) temporal.with( ChronoField.NANO_OF_SECOND, newNanos ); MapValue filtered = fields.filter( ( k, ignore ) -> !k.equals( "nanosecond" ) );
@Test void shouldFilterOnKeys() { // Given MapValue base = mapValue( "k1", stringValue( "v1" ), "k2", stringValue( "v2" ), "k3", stringValue( "v3" ) ); // When MapValue filtered = base.filter( ( k, ignore ) -> k.equals( "k2" ) ); // Then assertMapValueEquals( filtered, mapValue( "k2", stringValue( "v2" ) ) ); }
@Test void shouldFilterOnKeysAndValues() { // Given MapValue base = mapValue( "k1", stringValue( "v1" ), "k2", stringValue( "v2" ), "k3", stringValue( "v3" ) ); // When MapValue filtered = base.filter( ( k, v ) -> k.equals( "k1" ) && v.equals( stringValue( "v2" ) ) ); // Then assertMapValueEquals( filtered, EMPTY_MAP ); }
@Test void shouldFilterOnValues() { // Given MapValue base = mapValue( "k1", stringValue( "v1" ), "k2", stringValue( "v2" ), "k3", stringValue( "v3" ) ); // When MapValue filtered = base.filter( ( ignore, v ) -> v.equals( stringValue( "v2" ) ) ); // Then assertMapValueEquals( filtered, mapValue( "k2", stringValue( "v2" ) ) ); }
MapValue filtered = fields.filter( ( k, ignore ) -> !k.equals( "microsecond" ) && !k.equals( "nanosecond" ) ); return mapFunction.apply( filtered, newTemporal ); int newNanos = validNano( null, micros, nanos ); TEMP newTemporal = (TEMP) temporal.with( ChronoField.NANO_OF_SECOND, newNanos ); MapValue filtered = fields.filter( ( k, ignore ) -> !k.equals( "nanosecond" ) );