I tried to store string tuples in a arraylist, when in the terminal I put the following command
> java Main -P A,60 B,90 C,50 D,40 E,70 F,100 G,1000
, but the elements are separated in two when the program finds a comma, so I get this output
A
60
B
90
C
50
D
40
E
70
F
100
G
1000
and I tried to get this output
A,60
B,90
C,50
D,40
E,70
F,100
G,1000
how I can fix it? here is my code
import java.util.ArrayList;
import java.util.List;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
class Main {
@Parameter(names={"-P"}, variableArity=true)
public List<String> values = new ArrayList<String>();
public static void main(String ... argv) {
Main main = new Main();
JCommander.newBuilder()
.addObject(main)
.build()
.parse(argv);
main.run();
}
public void run() {
for (String val: values) {
System.out.println(val);
}
}
}