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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
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