int smallestDepth = Integer.MAX_VALUE;
Map<Integer, List<ArtifactContentEntry>> perDepthList = new HashMap<Integer, List<ArtifactContentEntry>>();
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<ArtifactContentEntry>();
currentList.add( current );
perDepthList.put( current.getDepth(), currentList );
}
else
{
currentList.add( current );
}