Reputation: 2353
I'm new to lambdaj so trying to get more used to it. I want to update this code using lambdaj:
Passed in parameter Map<String, Device> devices;
final Map<String, String> resultHash = new HashMap<String, String>();
for (Device device : devices.values()) {
result.put(device.getAddress(), device.getName());
}
Thanks for you help
Upvotes: 1
Views: 1145
Reputation: 17769
From the top of my mind:
LambdaCollections.with(devices.values())
.index(Lambda.on(Device.class).getAddress())
.convertValues(Lambda.on(Device.class).getName());
Upvotes: 4