It’s not a variable but an interface
. Classes & interfaces act as datatypes too:
Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html
The class
Collections isn’t the same as the interface
Collection:
Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collections.html
For the interface Collection, it’s this import
statement instead:
import java.util.Collection;
It’d be better if @hamoid’s code had included all the needed import
statements as well.