Added proper result typing for JavaQueue