public ShardIterator activeInitializingShardsIt(int seed){
  if (allInitializingShards.isEmpty()) {
    return new PlainShardIterator(shardId,shuffler.shuffle(activeShards,seed));
  }
  ArrayList<ShardRouting> ordered=new ArrayList<>(activeShards.size() + allInitializingShards.size());
  ordered.addAll(shuffler.shuffle(activeShards,seed));
  ordered.addAll(allInitializingShards);
  return new PlainShardIterator(shardId,ordered);
}

public ShardIterator activeInitializingShardsIt ( int seed ) { if ( allInitializingShards . isEmpty ( ) ) { return new PlainShardIterator ( shardId , shuffler . shuffle ( activeShards , seed ) ) ; } ArrayList < ShardRouting > ordered = new ArrayList < > ( activeShards . size ( ) + allInitializingShards . size ( ) ) ; ordered . addAll ( shuffler . shuffle ( activeShards , seed ) ) ; ordered . addAll ( allInitializingShards ) ; return new PlainShardIterator ( shardId , ordered ) ; }
returns an iterator over active and initializing shards . making sure though that its random within the active shards , and initializing shards are the last to iterate through .
