@ Override public E get ( ) { if ( originalElements . isEmpty ( ) ) { return null ; } if ( ! priorityElements . isEmpty ( ) ) { return priorityElements . remove ( 0 ) ; } if ( currentElements . size ( ) <= originalElements . size ( ) ) { currentElements . addAll ( originalElements ) ; } int index = random . getInt ( currentElements . size ( ) - 1 ) ; return currentElements . remove ( index ) ; }
Returns the next random element .