queue java version implemeted