开发者

Easy access to entries in set - using where conditions

The class structure is of the following format-

class A
{
   Set<B> bHolder;
}

class B
{
   Set<C> cHolder;
}

class C
{
   String data;
}

Goal : To 开发者_如何学Pythonretrieve an entry from class A depending on the data in class C

Eg: get B from aObject.bHolder.cHolder.data = "compareString"

Is there any way to do it without completely through the sets?

Thx -Kiru


Not when you've just got sets, no. If you want to perform some sort of lookup, you need a collection which supports lookups, such as HashMap (or a Map in general).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜