public static < T > Iterator < T > iterator ( Queue < T > queue ) { return new XIteratorImpl <> ( ( ) -> ! queue . isEmpty ( ) , queue :: remove ) ; }
Returns Queue as iterator . Calls isEmpty and remove methods