}
}
}
}
IndexHelper indexHelper = new IndexHelper(peers);
Integer foreachPosition = indexHelper.getIndex(foreach);
// the foreach with flatten can be swapped with an order by
// as the order by will have lesser number of records to sort
// also the sort does not alter the records that are processed