protected static void addVolume(List<BlockObjectRestRep> blockObjects,VolumeRestRep volume,List<BlockSnapshotRestRep> snapshots){
  blockObjects.add(volume);
  if (CollectionUtils.isNotEmpty(snapshots)) {
    Iterator<BlockSnapshotRestRep> snapshotIter=snapshots.iterator();
    while (snapshotIter.hasNext()) {
      BlockSnapshotRestRep snap=snapshotIter.next();
      if (ResourceUtils.idEquals(snap.getParent(),volume)) {
        blockObjects.add(snap);
        snapshotIter.remove();
      }
    }
  }
}

protected static void addVolume ( List < BlockObjectRestRep > blockObjects , VolumeRestRep volume , List < BlockSnapshotRestRep > snapshots ) { blockObjects . add ( volume ) ; if ( CollectionUtils . isNotEmpty ( snapshots ) ) { Iterator < BlockSnapshotRestRep > snapshotIter = snapshots . iterator ( ) ; while ( snapshotIter . hasNext ( ) ) { BlockSnapshotRestRep snap = snapshotIter . next ( ) ; if ( ResourceUtils . idEquals ( snap . getParent ( ) , volume ) ) { blockObjects . add ( snap ) ; snapshotIter . remove ( ) ; } } } }
add the volume and its snapshots to the ' blockobjects ' list . when the method completes the snapshots that have been added to the blockobjects list will be removed from the snapshots list .
