question: protected List < BlockObject > sortFullCopySourceList ( List < BlockObject > fcSourceObjects ) { List < BlockObject > sortedSourceObjects = new ArrayList < BlockObject > ( ) ; Map < String , BlockObject > fcSourcObjectsMap = new HashMap < String , BlockObject > ( ) ; for ( BlockObject fcSourceObject : fcSourceObjects ) { fcSourcObjectsMap . put ( fcSourceObject . getLabel ( ) , fcSourceObject ) ; } List < String > fcSourceLabels = new ArrayList < String > ( fcSourcObjectsMap . keySet ( ) ) ; Collections . sort ( fcSourceLabels ) ; for ( String fcSourceLabel : fcSourceLabels ) { sortedSourceObjects . add ( fcSourcObjectsMap . get ( fcSourceLabel ) ) ; } return sortedSourceObjects ; }
target:  Sorts the passed list of full copy source objects based on the natural sort order of their labels. Used to align the labels for the full copies with their sources. For example say you have a CG with two volumes foo-1 and foo-2, and you then create a full copy of one of these volumes. Because they are in a CG, a full copy is created for each volume in the CG. When we create the full copies with a name of bar, then we want the full copy for foo-1 to be bar-1, and the full copy for foo-2 to be bar-2. However, when you get the volumes in the CG, there is no guarantee of order. Now there is no restriction that volumes in a CG are named like this, but often they are because often one would create multiple volumes in a CG in a single request. So, in this simple case, then the full copy names should align. We can always create a more sophisticated comparator for the sort routine if something more elaborate is desired.