Click here to Skip to main content
15,890,946 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The following set contains integer, I need to replace any number which is multiple of 10 by "ten". Can anyone guide me in the right direction please?? How can I replace strings by integers.


XML
descendingOrder=(TreeSet<Integer>)sortedSet.descendingSet();
       System.out.println("The sorted list is:");
       System.out.println(descendingOrder);
Posted

1 solution

You cannot directly replace a type by a different type. However (if I understand your question correctly), while printing the list, you just need to check each value to see if it is a multiple of 10, and if so print some string information instead of the value.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900