remove unnecessary type parameter
added JavaDoc for tail
added tests for tail