hopefully doing the get-first-element in java is faster than in ruby