java - What does the dot operator `.` (before the generic parameter) mean? -
i saw code today:
immutablemap<class<? extends clientcommand>, commandprocessorinterface> immutablemap = immutablemap.<class<? extends clientcommand>, commandprocessorinterface>of(... what syntax mean?
immutablemap.<class ..
i knew generics right after class name. no?
what difference between:
immutablemap<class.. , immutablemap.<class..
it means you're invoking generic static method, called of in immutablemap class.
it's pretty same you're invoking static method, nested in class:
someclass.staticmethod(); for cases when method has type-parameter defined, can explicitly provide generic type , done this:
someclass.<type>genericstaticmethod(); and answer final question:
what difference between
immutablemap<class...>,immutablemap.<class...?
the first used when creating instance of generic class. it's used define generic-type on class level, while second used invoke generic static method that's nested in class.
Comments
Post a Comment