scala - Java .map() implementation -
this question has answer here:
- scala java (functional programming) 2 answers
please me implement .map function works on list classes/interfaces in java 7. cannot use features of java 8 or external libraries. needs similar scala's function in implementation , return values if possible. (maybe impossible).
this different question so-called "duplicate" because asks different entirely. have tried find implementation of function or pointers on putting 1 together, no luck. have asked here , had no luck in implementing suggestions or code given. has been said "trivial" function, , yet, evades me.
to groupby in java 7 have this.
map<k, list<v>> map = new hashmap<>(); for(v v : charges) { k k = v.getcc(); list<v> values = map.get(k); if (values == null) map.put(k, values = new arraylist<>()); values.add(v); } of course easier in java 8.
Comments
Post a Comment