int smallestDepth = Integer.MAX_VALUE;
Map<Integer, List<ArtifactContentEntry>> perDepthList = new HashMap<>();
for ( Map.Entry<String, ArtifactContentEntry> entry : entries.entrySet() )
{
ArtifactContentEntry current = entry.getValue();
if ( current.getDepth() < smallestDepth )
{
smallestDepth = current.getDepth();
}
List<ArtifactContentEntry> currentList = perDepthList.get( current.getDepth() );
if ( currentList == null )
{
currentList = new ArrayList<>();
currentList.add( current );
perDepthList.put( current.getDepth(), currentList );
}
else
{
currentList.add( current );
}