how to do filter/query on in-memory list using guava

26 views
Skip to first unread message

Rushit

unread,
Mar 1, 2012, 12:22:26 PM3/1/12
to guava-discuss
I have complex objects

class Person{
Integer id;
String fname;
String lname;
//..... there are more attributes
List<Address> addresses;
}
class Address{
String street1;
String street2;
String city;
String state;
String zip;
}

I have about 30000 Person objects and each has at-least 200-500 sub
object (addresses). Now I have all these in-memory and i have
different scenarios (20-30 scenarios) where i have to query/filter
objects based on filters available in scenarios. For eg.

* scen1 -> get all object having lname = 'zoik'
* scen2 -> get all object having lname = 'smark' and
address.street1 = "xyz"
* scen3 -> get all object having lname = 'smark' and
address.street1 = "xyz" and address.street1 = "pqr" (remember each
object has multiple address so i need object which has both address
which satisfy above condition.)
* scen4 -> get all object having fname= "smith" and lname =
'smark' and address.city="Los Angeles"
* .....

In short, there are multiple scenarios with different combination of
both the objects. Please advice the best way to utilize Guava for such
case?

Charles Fry

unread,
Mar 1, 2012, 12:25:18 PM3/1/12
to Rushit, guava-discuss
Please post to stackoverflow, per the instructions on our homepage. :-)


Reply all
Reply to author
Forward
0 new messages