I was wondering if there is a way to make the first two lines of the following code a one-liner in Java, so that object is declared, assigned and null checked in one line:
Object object;
if ((object = queue.poll()) != null) {
// do something with object
}