06-01-2011 06:10 AM
Hi - can someone put me out of my misery with this little one please. Using v 5 of the SDK. All I want to do is create a blank new integer in a peristent storage object for use at a later date (like creating an empty string). So this code fails but I don't know how to get around it:
persistentHashtable.put("Test", new Integer());
error message says Integer(int) in java.lang.Integer cannot be applied to () so presumably you can't initalise this without specifying a value. I don't want this initialised with a value of 0 because thats a value - all I want is an empty integer. Quotes doesn't work, null doesn't work - help pls?
Solved! Go to Solution.
06-01-2011 07:02 AM
06-01-2011 07:04 AM
There is no 'undefined' value for the Integer object as you have found.
The two options that immediately spring to mind are:
a) Create an extended Integer that supports a 'blank' setting
b) Use null to indicate this.
(b) means not having a value in the Hashtable - so the lack of value indicates a blank Integer.