|
| |||||||||
| Tags: hashmap, javautil, map, programming language, values |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Associated values with HashMap
Hello, All this corresponds to a program that should provide the shortest path between two vertices of a weighted graph. My structure is this: Code: private HashMap <Summit, trst <arc>> graph; Code: private String nm; private int plusCourt; / / Evaluation Associate at Summit Code: private Summit arr; private int wg; Code: for(S Summit: graph.keySet()){
if(s.getName()== Departure)
{
sommetDepart = s;
s.setPlusCourt(0);
}
else
{
s.setPlusCourt(3255);
}
} |
|
#2
| |||
| |||
| Re: Associated values with HashMap
Hello, Just have a look at the code below, this will describe a function and I think you are interested in this. Code: if(s.getName()== Departure) |
|
#3
| |||
| |||
| Re: Associated values with HashMap
Hello, Even I am trying a code something like this. In fact I put this bit of code before and after treatment: Code: TreeSet <arc> t;
for(S Summit: graph.keySet()){
t = graph.get(s);
System.out.System.out.println(t);
} |
|
#4
| |||
| |||
| Re: Associated values with HashMap
Hey, Here is my modified code, have a look and if I am wrong somewhere then you can correct me. Code: for(S Summit: lesKey){
Summit tsm = s;
TreeSet <arc> tmpTree = graph.get(s);
if(s.getName().equals(Departure))
{
sommetDepart = s;
s.setPlusCourt(0);
graph.remove(tsm);
graph.could(s, tmpTree);
}
else
{
s.setPlusCourt(3000);
graph.remove(tsm);
graph.could(s, tmpTree);
}
} |
|
#5
| |||
| |||
| Re: Associated values with HashMap
Hi, Okay, you can add the following to your code and see how it is compiled. Code: HashMap <Summit, TreeSet <arc>> mtp = graph; Set <VERTEX> lsky = mtp.keySet(); |
|
#6
| |||
| |||
| Re: Associated values with HashMap
Hello, Ok, I have modified my code and this is what I have with me now. Code: TreeSet <arc> t = graph.get(sommetDepart);
for(Arc: t){
if(sommetDepart.getPlusCourt()+ a.getPoids()<a.getArrivee().getPlusCourt()){
a.getArrivee().splcrt(sommetDepart.getPlusCourt()+ a.getPoids());
}
} |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Associated values with HashMap" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| W32 registry values are not getting matched by the default values | Angrzej | Networking & Security | 5 | 19-05-2011 01:23 PM |
| Sorting a hashmap | Gunner 1 | Software Development | 5 | 10-02-2010 05:06 AM |
| Iteration over a hashmap | New ID | Software Development | 5 | 07-02-2010 03:40 AM |
| What is HashMap and Map? | TAIPA | Software Development | 4 | 27-02-2009 11:16 PM |
| bug in WMP version 11 - DRM values show incorrect values | Ollie Riches | Media Player | 4 | 06-04-2007 05:08 AM |