Actully i want one logic,please any one telle. I have HashMap which will strart jan-2007=4443.778,feb-2007=56556.77 like this up to dec-2009(Here key is month && Year)this is Parameter to my method. I have to return previous year value for current Year.this is my output.for jan-2007 there would be no Previous year thts why I have to return Zero.
1. you are trying to put in the resultmap ,the key & value belonging to same year.(key-preYear,value-corresponding to pre value) 2.Also replaceAll is not working here ,try to ouput the value of year1 & you will know its not getting replaced.And so further processing fails. 3.newyear for which you are trying to replace should be year-1 and not year +1.
solution: Declare datatype for year as long & not double.because then you dont have to worry for truncating the double when used in replaceAll method.
Well,here is the solution, you can just copy paste the method: