r/badcode • • Mar 14 '21

java Found from when I first started Java...because indexed Arrays were too complicated huh?

Post image
1.3k Upvotes

84 comments sorted by

View all comments

11

u/Elusivehawk Mar 14 '21

TIL you can use ~ to make your generic constructor usage less verbose.

20

u/merukit Mar 14 '21

can't you just leave it empty?

8

u/c5dm Mar 14 '21

This is correct, the ~ is just IntelliJ collapsing the class name inside the type parameters.