Java 15 > – Optional if present and AtomicReference – Variable outside Lambda expression HowTo

Sometimes I want to use the Optional’s feature with if/else plausibility check and discover that an outside variable would come in handy.
There are different ways of doing it but here is mine:

AtomicReference<Optional<Foo>> outsideVar = new AtomicReference<>(Optional.empty());
optional.ifPresentOrElse(filledOptional -> {"Something happened: {}", filledOptional);
  outsideVar.set(Optional.of(new Foo(filledOptional)));
 }, () -> {
   LOGGER.error("Empty value!");

Intellij „No tests were found“

Today my IntelliJ did not want to start otherwise correctly running JUnit Tests. Maven went well, but IntelliJ insisted that there was no test.

I add these dependencies and then, it worked:


How to install Open JDK on Mac OS

Use SDK Man:

$ curl -s "" | bash

Follow the instructions on the screen.

$ source "$HOME/.sdkman/bin/"

Press ENTER.

$ sdk version
#should respond with sdkman 5.x ...

To install a JDK with it (this is OpenJDK 15):

$ sdk list java
$ sdk install java 15.0.1-open
$ sdk default java 15.0.1-open
$ sdk use java 15.0.1-open

You should use OpenJDK because by using Oracle you will have to pay a commercial fee, at least in commercial environments. This will eventually cause companies to abandon Java in worst case.

Webflux Reactive Webclient call with Flux Response and AtomicReference

* This blocking call will return an AtomicReference which contains the response, the first which is received.
* You could also return via your Websocket, by directly passing on the FLux response!
* @param client - The Webclient, in this case Netty
* @param input - A String, arbitrary text message (I prefer JSON)
* @return AtomicReference, containing the response
private AtomicReference<List<String>> callFooService(ReactorNettyWebSocketClient client, Flux<String> input) {
AtomicReference<List<String>> actualRef = new AtomicReference<>();

client.execute(getUrl(), session ->
return actualRef;

WebEx Pair Programming Feature

In a Webex meeting both Keyboard and Mouse can be shared.

Anyone can directly control what is on the screen in realtime.
I just tried it with a current customer and it is a tremendous feature:

Top Bar -> Assign+ -> “Pass Keyboard and Mouse Control”

Java equals and hash code Contract

If two objects are equal, the hash code must be the same.

But the same hash code does not guarantee that two objects are equal.

Code example for a proper implementation:

    public final boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof MyClassOrInterface)) {
            //some do prefer #getClass but I don't
            return false;
        MyClassOrInterface that = (MyClassOrInterface) o;
        return Objects.equals(this.hashCode(), that.hashCode()) &&
                Objects.equals(name, &&
                Objects.equals(sessionId, that.sessionId);

    public final int hashCode() {
        return Objects.hash(name, sessionId);

Java – How to verify EQUALS and HASH code contracts

Use this:

<!-- Maven -->

Write your test:

public void onEqualsTrueTheHashCodeHasToBeTheSame() {