I created only one list.
I added N strings to the list.
now in German the description is: move M strings to the end of list.
By using Collection.rotate(liste, 4) it works.
And finally Console shows the list correctly.
So I guess the English description says something different?
Or can anyone tell me, what I did wrong?
package de.codegym.task.task07.task0720;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.*;
/*
Gerade noch rechtzeitig gemischt
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(reader.readLine());
int M = Integer.parseInt(reader.readLine());
ArrayList<String> liste = new ArrayList<String>();
for(int i=0; i<N; i++){
liste.add(reader.readLine());
// System.out.println(liste.get(i)); //Kontrolle
}
Collections.rotate(liste, 4);
for(int i=0; i<liste.size(); i++)
System.out.println(liste.get(i)); //Kontrolle
}
}