Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use the add or get(calendar.Year) to add years one by one

HI

       i want to add the every year into the list . is this code is correct or wrong .

      please give me a solution ..  after that i want use this YearIist in some other class

public List<Integer> getYearList()

   {

       Calendar calendar=Calendar.getInstance();

          List<Integer> years = new ArrayList<Integer>();

          for(int num=0;num<=5;num++){

          years.add(calendar.get(Calendar.YEAR)+num);

           }

               return years;

   }

0 Replies