I'm having a hard time doing this.
Assuming I have two objects of type Person , which has the name and job attributes.
P1 (name = John, job = Taxi Driver)
P2 (name = Mary, job = Programmer)
So I would like to generate the possible combinations of these two objects, of course without attribute errors, for example an object having for example the name Taxiper.
The output I would need in case would be.
P3 (name = John, job = Programmer)
P4 (name = Maria, job = Taxi Driver)
How can I do this? Are there libraries that allow me?
EDIT
An example code would look something like this:
...
Pessoa p1 = new Pessoa("João","Taxista");
Pessoa p2 = new Pessoa("Maria", Programador;
List<Pessoa> listaDePessoas = new ArrayList<Pessoa>;
listaDePessoas.add(p1);
listaDePessoas.add(p2);
List<Pessoa> novaLista = new ArrayList<Pessoa>;
novaLista = geraCombinacoes(listaDePessoas); //esse seria o método por exemplo.
Then when printing this list the output would be:
(John, Taxi Driver)
(Mary, Developer)
(John, Developer)
(Maria, Taxi Driver)