java

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:

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.

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:

How to configure an Android project to use Java 8

As a quick note today, if you need to configure an Android project to use Java 8, I found that adding this setting to the app-level build.gradle file worked:

compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

You can also use this syntax:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

That setting goes inside the android setting in the build.gradle file, as shown here:

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: