How to use DataAccess to store Long Int map in GraphHopper

I found this : graphhopper-osm-id-mapping/src/main/java/com/graphhopper/osmidexample/MyGraphHopper.java at master · karussell/graphhopper-osm-id-mapping · GitHub

// Set
long pointer = 8L * edgeId;
edgeMapping.ensureCapacity(pointer + 8L);

edgeMapping.setInt(pointer, bitUtil.getIntLow(osmWayId));
edgeMapping.setInt(pointer + 4, bitUtil.getIntHigh(osmWayId));

// Get
long pointer = 8L * internalEdgeId;
return bitUtil.combineIntsToLong(edgeMapping.getInt(pointer), edgeMapping.getInt(pointer + 4L));

In this sample, it use DataAccess to store EdgeId(Int) → OSMWayId(Long) mapping, however I want to do it conversely, use OSMWayId(Long) as Key, EdgeId(Int) as Value and store it into DataAccess, but no idea how to, can anyone help ? thanks

Try to avoid duplicate posts

If you intend to map OSM IDs to internal IDs then you should not use the DataAccess as you’ll get huge holes wasting lots of memory. Instead use some external storage like MapDB, a simple HashMap or our more memory efficient map implementation for special cases used in OSMReader for this task. All depending on your requirements.

Sorry for duplicated post,
I just want to save what I import, exactly same as your sample but use osm way id (long) as key and edge id (int) as value, because I use osm way id to lookup the road is exist in my map and do the mapping if possible, not all data.
Is there any way to do it ? Many thanks

Sorry, I do not understand your use case. What are you trying to do? What do you mean with “and do the mapping if possible, not all data”?