package com.tutego.insel.util;

import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class RotateTheList
{
  public static void main( String[] args )
  {
    List<String> list = new ArrayList<String>( Arrays.asList( new DateFormatSymbols().getShortMonths() ));
    System.out.println( list );  // [Jan, Feb, Mrz, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez, ]
    Collections.rotate( list, 2 );
    System.out.println( list );  // [Dez, , Jan, Feb, Mrz, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov]
    Collections.rotate( list, -2 );
    System.out.println( list );  // [Jan, Feb, Mrz, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez, ]
  }
}
