• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using a Loop Value for an Object Assignment  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1783
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to attempt the following with no success:

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a function call on the right-hand side of the assignment. What is it that you are expecting that to do?
 
Steve Dyke
Ranch Hand
Posts: 1783
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You have a function call on the right-hand side of the assignment. What is it that you are expecting that to do?


I want to create several sheets with different tab names. Then I will run another loop on a data array to populate each sheet. This second loop will have to know what each sheet object name is.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps an array?
 
Steve Dyke
Ranch Hand
Posts: 1783
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Perhaps an array?


Can you elaborate? I have an array of tab names. My loop iterates through this array creating the HSSFSheets. However, I need the HSSFSheet objects to retain unique names so I can reference them latter in my code.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can reference them just as easily using an array. But if you also need unique names, perhaps a Map?
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you want a Map<String,HSSFSheet>.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!