When the type name is too long, in C# i can create alias like this:
using Dict = System.Collections.Generic.Dictionary<string, string>;
And I can use it like this:
Dict d = new Dict();
d.Add("key", "value");
Can I create an alias similar to this in Java?
You can’t create an alias, but you can
importpackages (JLS 7.5 Import Declarations) so that you don’t have to fully qualify class names in that package.You can also do a
static import(guide), though this practice should be limited.