There is not enough information here to make it easy to answer your question. You don't tell us what the program is doing, you don't tell us what's in the files. I can see multiple file names, and I guess the "k,v" lines are "key, value"? From one of the files? Only some of the files, or all of the files?
For good measure, you could point to specific lines that you expected to behave differently; for example, if there's a loop that is supposed to be reading more than one line of the file, where is it? This both shows that you have thought through the problem and have a specific question, and makes it easier for those of us volunteering our time to help you.
Please use code tags to format the code; it is to your advantage, since people are more likely to just skip trying to help rather than attempting to plow through unformatted code.
I don't know if it is this that is causing the problem (because as Ralph and John say, it's difficult to know what the problem is), but line 29 is definitely wrong.
Search the forum for posts about comparing Strings.
It’s much easier to read code if you indent correctly; use spaces only, not tabs. Set up your editor to change tab to 4 spaces automatically. And put spaces around binary operators (eg ==) not around unary operators (i++ is better than i ++).
Joined: Oct 18, 2011
1.Recognize the folder ,then iterating each of the files.
2.Read each line of the file to skip the unnecessary data and read all the k,v pairs.
3.Put them in the TreeMap for the sorting based on values( while inserting i am reversing the places of k,v )
this process is done for all the files in the folder(here comes the problem as i mentioned)
4.Now convert the Tree Map to Linked Hash Map for the order to be maintained while writing in to a file where they are displayed as normal k,v pairs (ie; while writing to the file v,k pairs of Tree Map are converted to k,v pairs)
I wrote the code to display the file name first then the k,v pairs from that file
But the out put is that the first class k,v pairs are only read and the rest is skipped but the file names are being read.
In consideration of the reply::
1.k,v refers to key, values.
2.The file in the directory contains data like the dat given bellow and same structure is found in all the files.
3.The problem is that the control is coming out of the while loops after reading the first line from the files to be more certain, i found the problem must be between the lines 41 to 54. when the iteration for 2nd file started, the variable is happening to null or the break statement is happening to be executed. since then the control is coming out of the loop.
Joined: Aug 05, 2005
Teja Nakirikanti wrote:i found the problem must be between the lines 41 to 54.
As I said in my last post, there is a problem on line 41*. I don't know if it is the only problem but you need to fix that first before trying anything else.
*My previous post referred to line 29. That was in John's version of your code. Now that code tags have been added to your original post, we can see that it is line 41 in that version of the code.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Files from a directory is not being recognized