我正在尝试将“转换”应用于List <Map <String, String>>
. 是否可以在“ Function.apply
”方法中获取列表中当前项的索引?
Lists.transform(data, new Function<Map<String, String>, Map<String, String>>() {
private static int index = 0;
@Override
public Map<String, String> apply(Map<String, String> from) {
from.put(key, value); // need to get index
return from;
}
});