• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question on the ArrayList  RSS feed

 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The bolded code gives me an error message that give me this error, "The method set(int, Object) in the type ArrayList is not applicable for the arguments (void,
String):". I need to be able to change a null value to a "0". Any suggestions or direction would be appreciated.

Here is my code:

 
Scott Selikoff
author
Bartender
Posts: 4093
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code doesn't make much sense. You can't call a setter using a setter since setter are usually void. Why do you need two sets? I would think the inner set would suffice.

Either way your call to "rows[i][DESCINDEX].getFieldValue().setValue(zero)" returns nothing and cannot be used as an input parameter. Perhaps breaking this into multiple lines will shed some light on what you meant to do.
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scott,

Sorry the code does not make much sense. The zero variable is equal to "0". So I was trying to set the NULL value to a "0" value. If this is not an intermediate question, I can post it in the beginners section. Just let me know.

Thanks.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Melinda Savoy:
Scott,

Sorry the code does not make much sense. The zero variable is equal to "0". So I was trying to set the NULL value to a "0" value. If this is not an intermediate question, I can post it in the beginners section. Just let me know.

Thanks.


Yes, but the setValue() method doesn't return a NULL value. In fact, it doesn't return any value whatsoever, it is a void. Which is why the compiler can't find a matching method for the parameters that you passed.

Henry
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just guessing at what your trying to do, but I prefer to introduce
temporary variables to break down complex expressions and extract common
subexpression, for readibility. Trying this on your code:

[ November 04, 2005: Message edited by: Jeff Albrechtsen ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!