java

A Java JFreeChart x/y plot/chart/graph example alvin June 29, 2019 - 12:10pm

In an effort to share some source code (but without taking the time to explain it), here’s some Java source code that I just used to create a JFreeChart chart/graph of some data that I use in my Android football game:

Java: A Java list `tail` function (for ArrayList, LinkedList, etc.) alvin June 27, 2019 - 1:48pm

As a brief note today, I was working on a Java/Android application recently, and I needed a “tail” function when I was working on a Java list. What I mean by that is that Scala has a tail function that returns all elements of the list except for the head element, like this:

scala> val x = List(1,2,3,4)
x: List[Int] = List(1, 2, 3, 4)

scala> x.tail
res1: List[Int] = List(2, 3, 4)  //head element removed

and I wanted the same thing in Java.

Java: Examples of the Java list/array `subList` method (list subset) alvin June 27, 2019 - 12:26pm

As a little note today, if you ever need to extract a subset of a Java list or array, here are some examples of the Java subList method:

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:

RxJava’s Side Effect Methods

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

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: