开发者

Easy access to entries in set - using where conditions

开发者 https://www.devze.com 2023-01-25 05:59 出处:网络
The class structure is of the following format- class A { Set<B> bHolder; } class B { Set<C> cHolder;

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

精彩评论

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