Re: Dynamic Groups

42 views
Skip to first unread message

Jett

unread,
Sep 13, 2012, 4:23:43 AM9/13/12
to lam...@googlegroups.com

I found out how to do this. I don't know if it's the proper way to do it but it does work:


        // this is how it's done in a not dynamic way
        Group<Map> initial = group(entries, by(on(Map).get("Instrument")), by(on(Map).get("ISSUE")))



        // the alternative (Dynamic)
        // create method that builds a collection containg a set of GroupCondition
        GroupCondition condition = by(on(Map).get("Instrument"));

        Collection<GroupCondition> conditions = new ArrayList<GroupCondition>();
        conditions.add( condition )

        Group<Map> dynamic = group(entries, conditions)



On Thursday, September 13, 2012 3:31:18 PM UTC+8, Jett wrote:
I just started using lambdaj last week. So far it's an impressive library for what I need.

I was wondering if it is at all possible to add group parameters dynamically. For instance, I have the following code:

Group<Map> initial = group(entries, by(on(Map).get("Instrument")), by(on(Map).get("ISSUE")))

Is it possible to add the 2nd, 3rd ... nth parameters for group dynamically?

Thank you
Reply all
Reply to author
Forward
0 new messages