Zolf
asked on
HashMap return type
Hello there,
I have this line of code
which returns a Hashmap<String,String>
SSSS {Qty=45, Name= Regulator , Sr.No.=1}
now I want to remove the Qty data only from this output.how can i do it.
cheers
ZOlf
I have this line of code
System.out.println(" SSSS "+listModel.get(info.position - 1));
which returns a Hashmap<String,String>
SSSS {Qty=45, Name= Regulator , Sr.No.=1}
now I want to remove the Qty data only from this output.how can i do it.
cheers
ZOlf
ASKER
i mean get only the qty data from the Hashmap. basically i am writing a feature to update the qty when user enters a wrong qty. so i am trying to get the qty amount from the list and update it with the new value. please help
listModel.get(info.positio n - 1).get( "Qty" ) ; //will give only quantity
listModel.get(info.positio n - 1).set( "Qty", 50 ) ; //will update qty to 50
listModel.get(info.positio
ASKER
it will hold the qty in a String.correct?
something like this
String qty = listModel.get(info.positio n - 1).get( "Qty" ) ; //will give only quantity
something like this
String qty = listModel.get(info.positio
>>it will hold the qty in a String.correct?
depends on how the map is defined, it may hold String/Object. print the type of the value and you'll come to know but based on definition of the maps, you may have to typecast.
depends on how the map is defined, it may hold String/Object. print the type of the value and you'll come to know but based on definition of the maps, you may have to typecast.
and could be a Number type too!
ASKER
print the type of the value and you'll come to know but based on definition of the maps, you may have to typecast
can you please give me an e.g.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
listModel.get(info.positio
if you want to remove from just the string representation, try this
System.out.println(" SSSS "+listModel.get(info.posit