Sneha Kashyap

Greenhorn
+ Follow
since May 06, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sneha Kashyap

Thanks
Hey can you please help me with some sample code.
13 years ago
Hi,
I am trying to sort a list of lists


the data in the list is something like this
{[def,ghi,xml],
[abc,ghi,cde],
[cat,ghi,der]}
I want the data to be
{[abc,ghi,cde],
[cat,ghi,der],
[def,ghi,xml],}
I am not able to use Collections.sort(listOfLists)
Any help is greatly appreciated.
Thanks in advance.
13 years ago


Here instead of vector Candidates I have to use a hashmap and iterate similarly.
Please help me how to iterate over this loop with hashmap.
Just help me convert this code as required.
13 years ago

Pavel Kubal wrote:Why don't you itereate over keys and through keys you can get values?



Hey it would be great if you could help me with some sample code.
Please translate the above code and help me.
13 years ago

Campbell Ritchie wrote:Why are you using legacy code like Vector and StringTokenizer?



Would you please explain it in detail.
13 years ago
Hi,
I am trying to iterate over two the hashMaps where I need the combination of elements from both the hashMaps. The iteration must be something similar to bubble Sort

Instead of using an ArrayList I need to use a HashMap which holds the value and its associated count.I am unable to figure out what to use in place of indexes(i and j)
Please help me
Thanks in advance
13 years ago
Hi,
I am trying to iterate over two the hashMaps where I need the combination of elements from both the hashMaps. The iteration must be something similar to bubble Sort

Instead of using an ArrayList I need to use a HashMap which holds the value and its associated count.I am unable to figure out what to use in place of indexes(i and j)
Please help me
Thanks in advance
Hey Thanks a lot. I was able to implement it.
Java Ranch rocks
13 years ago
Hi Thanks Rob,
Let me explain my problemin detail
1. I want to read a file with each line stored into a seperate set.
2. I want to compare these sets(data from file) (to find if it is a subset) with another set containing similar data (I have used containsAll)
3. Find the frequency of each set and store the set and its count in a hashMap and all these has to be done recursively with the length of the set increasing.
Help me with this .
13 years ago
Hi thanks,

would be great if you could helpme with some sample code....
13 years ago
Hi,

data in the file(will be read into a Set) (I am not exactly sure as to which collection to be used for this purpose) Please suggest the collection to be used.

abc def ghi
abc ghi
def ghi abc
uvw xyz
xyz abc
xyz def

How to read each line in this file and store it in a collection and also help me as to which collection can be used.
Please provide some sample code for the same
Thanks.
13 years ago
Hi Thanks,

I know that containsAll() method can be used to fine if a set is the subset of another. My problem is I am not able to write code to traverse the set and the file.
Please help me with this
13 years ago
Hi Thanks,

I would be grateful if you could write some sample code.

BTW I have a HashMap<List<String>,Integer> I am not able to display the values in the map,I am not able to iterate
I have used
for(Entry<List<String>, Integer> entry:candidates.entrySet()){
System.out.println("Item:"+entry);
}
But the there are no values displayed.
13 years ago
Hi,

data in the file(will be read into a Set) (I am not exactly sure as to which collection to be used for this purpose) Please suggest the collection to be used.

abc def ghi
abc ghi
def ghi abc
uvw xyz
xyz abc
xyz def

Set<String> contains
abc
def
ghi
uvw
xyz

Each Set<String> must be compared with all the lines in the file and then the occurance count of the corresponding Set<String> and its value has to be stored on the HashMap.
This is to be done but I'm unable to figure out how to do it. Please help.

Thanks in advance.
13 years ago
Hi,

I have a set<String> with some data and I would like to perform something like this..

for each set<String> compare it with all the Set<String> in a file. I am trying to search if the elements in Set are present in the file if so increment the count variable

I am not able to write code for the same please help

I tried using two for-each loops but I get a cross product of all the sets. I know that the logic to implement this is something similar to bubble sort but I would like to know how to implement it using Set.

Please Help ASAP.
13 years ago