my dog learned polymorphism
The moose likes Java in General and the fly likes Using a Loop Value for an Object Assignment Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Using a Loop Value for an Object Assignment" Watch "Using a Loop Value for an Object Assignment" New topic
Author

Using a Loop Value for an Object Assignment

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1261
I am trying to attempt the following with no success:

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56543
    
  14

You have a function call on the right-hand side of the assignment. What is it that you are expecting that to do?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1261
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

Joined: Jan 10, 2002
Posts: 56543
    
  14

Perhaps an array?
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1261
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

Joined: Jan 10, 2002
Posts: 56543
    
  14

You can reference them just as easily using an array. But if you also need unique names, perhaps a Map?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

Perhaps you want a Map<String,HSSFSheet>.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using a Loop Value for an Object Assignment
 
Similar Threads
Access a variable
JSP called from filter not finding JavaScript file
lockCookie
for loop question
assignments and + operator