Make the alias method tail recursive to avoid stack overflow

This PR makes the alias method tail recursive, in order to avoid throwing a `java.lang.StackOverflowError` exception on large collections.