Why does this stream return no element?

Seems that you are using EclipseLink prior to 2.6 version and hit the Bug#433075. This devices field is replaced with IndirectList (via reflection) which extends the Vector class and performs a lazy initialization. It was written for an older Java version which had no stream() method, so the stream() is actually called on uninitialized list returning an empty stream.

The bug is fixed, thus you probably have to update the EclipseLink to 2.6 version. In EclipseLink 2.6 another class is used when running on JDK 1.8 which is stream-friendly.

Leave a Comment