I have Set inputAssetIds.
An Asset can have a parent asset or a child asset (we call it being part of a budle, but thats irrelevant), or none of those (its a standalone asset).
For each of those inputAssetIds, i need to determine if its a standalone, or a parent (which means it is part of bundle, but it has no parent asset, it IS the parent of several assets), or if its a child asset … incase of it being a child, i need to know what is it’s parent.
There is a utility method which returns Map<String, Set> parentIdtoChildIdsMap, where key is a parent assetId, and value is Set of that parent’s child Asset Ids.
However, that map has more data than i need (it returns info on sibling assets etc etc).
How to check if an input asset is a standalone asset – If its not present in keys or values of parentIdtoChildIdsMap, its a standlone (its easy, but i need to get all keys and values in a single separate set to check if that set contains the inputAssetId)
How to check if an input asset is a parent asset – If its present in keys of parentIdtoChildIdsMap (this one is easy)
How to check if an input asset is a child (and i need info about who is the parent) – It will require me looping through keyset and checking if valueSet contains the input. This is the part i am worried about. Loop within loops
Now keep in mind, there are many input Asset Ids.
I can do it with ugly nested loops (extent of my knowledge). But wondering if there is some advanced way to do it, like flatten out the map parentIdtoChildIdsMap and quickly get the info (or if there is something fancy we can do with streamin APIs .. i am not too familiar with that either). I guess i dont know what i dont know. So its an open ended question on what algorithm will you use.
7