Tuesday, 22 December 2020

Notes on Unity

So I decided to try some game programming in Unity1.

Since it's all new to me, I'd thought I'd write some notes here, to remember how I did some things.

Skybox

add here how to add a skybox

Movement

also navigation

References

[1] Wikipedia - Unity
https://en.wikipedia.org/wiki/Unity_(game_engine)

Thursday, 17 December 2020

Payara and Jakarta 9

Interesting.

There's a tech preview in the latest Payara 5 application server1, that allows deploying Jakarta EE 9 applications.

The Eclipse Transformer basically auto transforms the classes and resource files back to the old packages, upon deployment.

References

[1] Payara - Eclipse Transformer Configuration Option with Jakarta 9 Milestone Release
https://blog.payara.fish/eclipse-transformer-configuration

Thursday, 10 December 2020

The Three options with Optional

There are basically three ways to deal with an optional, when receiving one.

  1. throw an exception if the optional is empty, because it's a faulty situation. (.orElseThrow)
  2. do not do anything, but proceed with the next step. (.ifPresent(dosomething))
  3. provide a default value. (.orElse(default))

I'm writing it down here, because each of these three cases is highly dependent on context.

And I've noticed in my work that I have a tendency to take option 2, even though it might be considered an error.

Thursday, 3 December 2020

Finding the index of an element in a List using Streams

So, I recently had a need to find out the index of an element in a List.

I could take the traditional approach, and use a for loop.

But I was wondering if I could use Streams, and if I could, would that be "better" (for some vague notion of "Better").

Any comments on what you would prefer, and why?

References

Baeldung - How to Iterate Over a Stream With Indices
https://www.baeldung.com/java-stream-indices