|
 |
Yes, I know it would be better to ask this in a Java forum, but I'm just
too lazy to dig one up (as well as not too eager to show my ignorance in
a random forum ;) ). Given the amount of programmers here, I'm sure at
least someone knows the answer to this.
In C++, if you have a very complicated template type, such as for example:
std::map<std::string, std::vector<std::vector<std::string> > >
it would be quite laborious to have to write that type every single time
when you need it. The solution to this is to create a type alias:
typedef std::map<std::string, std::vector<std::vector<std::string> > >
TheMap;
Now it's much shorter to use that type. For example:
TheMap m;
for(TheMap::iterator iter = m.begin(); iter != m.end(); ++iter)
...
Java supports generics, which are instantiated with a syntax very similar
to this. However, Java does not support type aliases.
Is there a way in Java to shorten those long type names?
--
- Warp
Post a reply to this message
|
 |