java

recent posts related to java, jdbc, spring, etc.

CAFEBABE? alvin April 16, 2019 - 7:14pm

And in the category of “Strangest Things I Never Knew About Java,” I give you ... CAFEBABE.

Best RxJava links: map, flatMap, concatMap, and more alvin March 28, 2019 - 2:28pm

As often happens, I have about 50 browser tabs open, and in an effort to close some of those down, these are some of the best links I found while working with RxJava a week or two ago:

Free Java and OOP training material alvin March 17, 2019 - 7:33pm

A long time ago — around 2009 — I initially shared some free Java and OOP training material. If you’re interested, you can find it here:

Diagram: What errors, checked exceptions, and unchecked exceptions look like in Java alvin March 17, 2019 - 5:12pm

I may work on this a little more over time, but here’s a little look at what errors, checked exceptions, and unchecked exceptions look like in Java:

RxJava’s Side Effect Methods alvin March 10, 2019 - 6:19pm

RxJava's Observable class has plenty of methods that can be used to transform the stream of emitted items to the kind of data that you need. Those methods are at the very core of RxJava and form a big part of it's attraction. But there are other methods, that do not change the stream of items in any way - I call those methods side effect methods.

How to debug RxJava Observable method calls/chains alvin March 10, 2019 - 4:48pm

As a brief note to self, when you need to debug a chain of RxJava Observable method calls, you can use the doOnNext method to log the current values or print them to STDOUT or STDERR with println. Here’s an example from RxJava For Android Developers, where the debug output is logged with the Android Log.d method:

Jeyes, a Java version of Xeyes alvin March 10, 2019 - 2:22pm

Jeyes, a Java version of Xeyes

In my spare time back in 2011 I created a Java version of the old Unix/X-Windows “Xeyes” application. If you ever used Xeyes, you know it as a set of eyes that are displayed on-screen, and follow the mouse cursor as you move it around.

Now in 2019 I just brought it back to life, and here’s a 56-second video that shows how it works:

A large list of people’s given names, sorted for Java/Kotlin/Scala testing alvin March 9, 2019 - 11:09am

If for some reason you ever need a list of people’s given names for testing your Java/Scala/Kotlin/JVM code, here’s a Java class with a sorted, static list of over 5,000 male and female given (first) names:

How to create an RxJava 2 Observable from a Java List alvin March 3, 2019 - 5:25pm

As a brief note, here’s an example that shows how to create an RxJava 2 Observable from a Java List:

A simple RxJava 2 “Hello, world” example alvin March 3, 2019 - 2:33pm

As a brief note, and assuming that you already know a little bit about RxJava, here’s the simplest possible RxJava 2 “Hello, world” example I think you can create:

package hello;

import io.reactivex.Observable;

public class HelloWorld {

    public static void main(String[] args) {
        Observable<String> observable = Observable.just("Hello, world");
        observable.subscribe(System.out::println);
    }

}