blackberry parameterised are only available if source level 1.5

匆匆过客 提交于 2019-12-12 02:12:05

问题


When i user vector object in my blackberry app like below

Vector<Object> vector = new Vector<Object>();

i am getting compiler error as

blackberry parameterised are only available if source level 1.5

why is this error?


回答1:


BlackBerry is based on JavaME which is currently limited to Java 1.3 syntax. Thus, since generics were added in Java 5 (1.5), you are out of luck, unfortunately.




回答2:


Classes compiled for the BlackBerry must use version 1.3 of Java, which precludes things like generics and enums. On top of that, the classes that are supported are very limited and do not include the collections classes.

However, the BlackBerry does provide a number of custom collection classes that pre-date the standard ones. You may wish to use these if the facilities provided by Vector and Hashtable are not adequate.




回答3:


Generics/Parameterized types were added in Java 5.0 (2004) Before this version, the feature didn't exist.

IMHO Vector is a legacy collection which was replaced by ArrayList in Java 1.2 (1998) but is still supported. You should consider using ArrayList if you can.



来源:https://stackoverflow.com/questions/4945863/blackberry-parameterised-are-only-available-if-source-level-1-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!