private static void assignLeftOverBlocks(Map<String,List<Distributable>> outputMap,Set<Distributable> uniqueBlocks,int noOfBlocksPerNode,List<String> activeNodes){
  if (activeNodes != null) {
    for (    String activeNode : activeNodes) {
      List<Distributable> blockLst=outputMap.get(activeNode);
      if (null == blockLst) {
        blockLst=new ArrayList<Distributable>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
      }
      populateBlocks(uniqueBlocks,noOfBlocksPerNode,blockLst);
      if (blockLst.size() > 0) {
        outputMap.put(activeNode,blockLst);
      }
    }
  }
 else {
    for (    Map.Entry<String,List<Distributable>> entry : outputMap.entrySet()) {
      List<Distributable> blockLst=entry.getValue();
      populateBlocks(uniqueBlocks,noOfBlocksPerNode,blockLst);
    }
  }
  for (  Map.Entry<String,List<Distributable>> entry : outputMap.entrySet()) {
    Iterator<Distributable> blocks=uniqueBlocks.iterator();
    if (blocks.hasNext()) {
      Distributable block=blocks.next();
      List<Distributable> blockLst=entry.getValue();
      blockLst.add(block);
      blocks.remove();
    }
  }
}

private static void assignLeftOverBlocks ( Map < String , List < Distributable > > outputMap , Set < Distributable > uniqueBlocks , int noOfBlocksPerNode , List < String > activeNodes ) { if ( activeNodes != null ) { for ( String activeNode : activeNodes ) { List < Distributable > blockLst = outputMap . get ( activeNode ) ; if ( null == blockLst ) { blockLst = new ArrayList < Distributable > ( CarbonCommonConstants . DEFAULT_COLLECTION_SIZE ) ; } populateBlocks ( uniqueBlocks , noOfBlocksPerNode , blockLst ) ; if ( blockLst . size ( ) > 0 ) { outputMap . put ( activeNode , blockLst ) ; } } } else { for ( Map . Entry < String , List < Distributable > > entry : outputMap . entrySet ( ) ) { List < Distributable > blockLst = entry . getValue ( ) ; populateBlocks ( uniqueBlocks , noOfBlocksPerNode , blockLst ) ; } } for ( Map . Entry < String , List < Distributable > > entry : outputMap . entrySet ( ) ) { Iterator < Distributable > blocks = uniqueBlocks . iterator ( ) ; if ( blocks . hasNext ( ) ) { Distributable block = blocks . next ( ) ; List < Distributable > blockLst = entry . getValue ( ) ; blockLst . add ( block ) ; blocks . remove ( ) ; } } }
if any left over data blocks are present then assign those to nodes in round robin way .
