use index iteration over iterator
This commit is contained in:
parent
32526f004c
commit
8658856b48
|
@ -194,13 +194,16 @@ public class RoutingNodes implements Iterable<RoutingNode> {
|
|||
public List<MutableShardRouting> shardsRoutingFor(String index, int shardId) {
|
||||
List<MutableShardRouting> shards = newArrayList();
|
||||
for (RoutingNode routingNode : this) {
|
||||
for (MutableShardRouting shardRouting : routingNode) {
|
||||
List<MutableShardRouting> nShards = routingNode.shards();
|
||||
for (int i = 0; i < nShards.size(); i++) {
|
||||
MutableShardRouting shardRouting = nShards.get(i);
|
||||
if (shardRouting.index().equals(index) && shardRouting.id() == shardId) {
|
||||
shards.add(shardRouting);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (MutableShardRouting shardRouting : unassigned) {
|
||||
for (int i = 0; i < unassigned.size(); i++) {
|
||||
MutableShardRouting shardRouting = unassigned.get(i);
|
||||
if (shardRouting.index().equals(index) && shardRouting.id() == shardId) {
|
||||
shards.add(shardRouting);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue