Use generics in sample snippet.

If generics isn't used, compile error occurs in for statement.