开发者

Searching strategy in an infinte list

I am listening to a 3rd party web-service, when the services starts it generates a stream of objects which I am receiving. I have to search for a specific object within given amount of time and do some processing if the object is found or throw an error in any of the below condition:

  1. The web-service stops and I haven't found the object.
  2. My timer expires.
  3. Any other erroneous condition.

I am wondering about what could be the best way to search for the ob开发者_Python百科ject assuming I am searching in an infinite list and the order of items in which they appear in the list cannot be predicted ?


If the order cannot be predicted, then there's no better way than simply testing each object as it is received.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜