2
I’ve hit my head and I couldn’t find the logic to do it. Well, I have a list of objects (Police): List and these objects have several properties, for example: organization, year, context and others.
What I need is to pass this list by a method and have the rest of a list of lists with the grouping of policies that have equal organization, year and context.
If for example I have these 4 policies:
P1 - organização: USP, ano: 2015, contexto: A
P2 - organização: USP, ano: 2015, contexto: A
P3 - organização: UFCG, ano: 2014, contexto: B
P4 - organização: UFCG, ano:2014, contexto B
The P1 and P2 objects and the P3 and P4 objects are similar, the return should be two lists, one with P1 and P2 and the other with P3 and P4. Could someone help me with logic? Thank you!
Two questions: Why these
policies
are not in abanco de dados
, where could you simply run a query? And why can’t youiterar
by comparing objects and creating a second list with the items you are looking for?– Daniel