Live Template to iterate over the entrySet of a map, utilising generics

Has anybody managed it? I've had a go, but got nowhere fast...

ie. I have this:
Map<String, String> mappings = getMappings();

and I want this to be generated underneath:
for (Map.Entry<String, String> entry : mappings.entrySet()) {
}

Cheers,
N.

2 comments
Comment actions Permalink

Hello Nathan,

In 7.0.3 EAP builds, the standard iter() live template does this.

Has anybody managed it? I've had a go, but got nowhere fast...

ie. I have this:
Map<String, String> mappings = getMappings();
and I want this to be generated underneath:
for (Map.Entry<String, String> entry : mappings.entrySet()) {
}
Cheers,
N.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Dmitry Jemerov wrote:

Hello Nathan,

In 7.0.3 EAP builds, the standard iter() live template does this.

>> Has anybody managed it? I've had a go, but got nowhere fast...
>>
>> ie. I have this:
>> Map<String, String> mappings = getMappings();
>> and I want this to be generated underneath:
>> for (Map.Entry<String, String> entry : mappings.entrySet()) {
>> }
>> Cheers,
>> N.
Blimey, you're right! I never noticed this... thanks Dmitry!
I just found this : http://www.jetbrains.net/jira/browse/IDEA-16499 -
Maybe you can close it now?

N.

0

Please sign in to leave a comment.