Şöyle yaparız
List<DayOfWeek> list = new ArrayList<>(List.of(DayOfWeek.MONDAY, DayOfWeek.TUESDAY,
DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SUNDAY));
Collections.rotate(list, list.size() - list.indexOf(DayOfWeek.WEDNESDAY));
System.out.println(list);
Çıktı olarak şunu alırız[WEDNESDAY, THURSDAY, FRIDAY, SUNDAY, MONDAY, TUESDAY]
Hiç yorum yok:
Yorum Gönder