after reading about streams I am trying to use them now and already with simple examples the first questions arise. I would like to implement a very simple encryption algorithm, which uses substitution. There is some text to be encrypted:
static List<Integer> text = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
There is some password:
private List<Integer> password = Arrays.asList(1, 5, 7, 3);
The idea is now to add the password values to the text values. The result should be
1+1, 2+5, 3+7, 4+3, 5+1, 6+5, ...
So I have to create a stream from password, which starts from the beginning when reaching the end of the above list. This part I already managed to do.
Now I somehow have to merge 2 streams into 1 stream. Any ideas, how to accomplish that?