java - Extract any value from hashmap (one for each key) -


i have large map different keys , several values (depthfeed) associated each. value (depthfeed) able extract name of instrument 1 each key.

i have map

private static map<integer, list<depthfeed>> mapdepthfeed = new hashmap<>(); 

from like, not returning keyset integer. instead want list<depthfeed> (containing 1 row each key)

list<depthfeed> d = mappricefeed.values().stream().distinct().collect(collectors.tolist()); 

use

list<depthfeed> result = mapdepthfeed.values().stream()             .filter(list -> !list.isempty())             .map(list -> list.get(0))             .collect(collectors.tolist()); 

this way first element each non-empty list stored in map values.


Comments

Popular posts from this blog

php - Hide output during test execution -

java - Drawing vector images on PDF with PDFBox -

Qt4: how to send QString inside a struct via QSharedMemory -