简体   繁体   中英

How can I refactor the element type of Generics in eclipse, any shortcuts?

I'm in trouble with refactorring the element type of generics, please check the image below,

The type of element is "String", and now I want to refactor it to "Integer", how should I do in eclipse. I DO NOT want to change the type of "titleName" !! . I've checked that if I select the type name and right-click, there is no "Rename" in the context menu :-(

I refactorred the type with the "help/replace" as a workaround, however, I don't think this is a good way, it may cause typos.

代码重构示例

well, I know my question is a bit little weird, but I think lots of guys may encoutered. For instance, how to change "Map<String,Integer> map = HashMap<String, Integer>()" to "Map<Integer,User> map = HashMap<Integer, User>()" ?

CTRL + F 
FIND: <String>
REPLACE WITH: <Integer>
Replace All

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM