import java.util.*;
public class PossibilityGame
{
private List<String> list1, list2, list3, list4;
public PossibilityGame()
{
list1 = new ArrayList();
list1.add("one");
list1.add("two");
list1.add("three");
list1.add("four");
list2 = new ArrayList();
list2.add("red");
list2.add("yellow");
list2.add("green");
list2.add("white");
list3 = new ArrayList();
list3.add("shirt");
list3.add("T-Shirt");
list3.add("denim");
list3.add("skirt");
list3.add("short");
list4 = new ArrayList();
list4.add("karate");
list4.add("tennis");
list4.add("foot ball");
list4.add("chess");
}
void generatePossibilities()
{
//Possibility Method Goes here
}
public static void main(String[]args)
{
System.out.println("Generating Possibilities");
PossibilityGame p = new PossibilityGame();
p.generatePossibilities();
}
}
In here, I have 4 arraylists, each containing 4 Strings. I want to generate the list of possibilities these strings can be printed. For an an example, have a look at the following
One, red, shirt, karate //Here, “one” is taken from list1, location 1; red is taken from list2, location 1; shirt is take from list3 location 1; karate is taken from list4 location1
one,yellow,T-shirt,tennis //Here, “one” is taken from list1, location 1; yellow is taken from list2, location 2; T-shirt is take from list3 location 2; tennis is taken from list4 location2
I want to generate all the possibilities as above examples. Please help. Thank you
1 Answer