|
| |||||||||
| Tags: equals, function, map, method, programming language, tools, utilities |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Trying equals with Map
Hello, I want to do the following using Maps - If the value is empty finish () - Otherwise if the value deb! = Null and value to finish! = (Null) -) Else ( For the first line I can not get the evenness, I try equals, compareTo, contains and stupidly == "" but that does not work. I put the code so that you can see the types of each variable. Code: Public void tmap(){
for(Iterator i = map.entrySet().ierator(); It.hasNext();) {
Entry e = (Entry) i.next();
Object k = e.getKey();
Object v = e.getValue();
for (Iterator j = ((AbstractList <GregorianCalendar>) v).ierator() J.hasNext() ; ) {
Interval interval = (Interval) j.next();
String interval = deb.Getstart();
String interval = finn.getFinish();
String d = interval.getJour();
String tm =""; }
}
} |
|
#2
| |||
| |||
| Re: Trying equals with Map
Hello, I am very new to java, but I found a code which I think is related to your topic. If you need you can try it out. Code: if(interval.getFinish().contains(Temp)){
System.out.System.out.println("nm:"K + +- Date of discharge:+ d);
}
else if(d! =null Finn & &! =null){
System.out.System.out.println("nm:"K + +"- st"+ + d"End"+ finn);}
else{
System.out.System.out.println("nm:"k + +"- Day of absence"+ Day) ;
} |
|
#3
| |||
| |||
| Re: Trying equals with Map
Hello, You can try the following code Code: Public class Interval {
private String st;
private String fns;
private String dt;
Public String getFinish() {
return fns;
}
Public void setFinish(String fns) {
this.fns = Finish;
}
Public String Getst() {
return home;
}
Public void setStart(String home) {
this.home = Start;
}
Public String toString() {
if(st! =null)
return "(" + Home + ", " + + Finish ")" ;
else
return "("+ day +")";
}
Public String getJour() {
return day;
}
Public void setJour(String days) {
this.day = Day;
}
} |
|
#4
| |||
| |||
| Re: Trying equals with Map
Hello, I think you can try the following. Code: Public void appelint(String nm, String dtb, String endt) throws ParseException {
ArrayList l = <interval> (ArrayList <interval>)map.get(nm);
if(l ==null){
l = new ArrayList <interval>();
map.could(nm, l); }
Interval j =new Interval() ;
j.setStart(dtb);
j.setFinish(endt);
l.add(j);
map.could(nm, l); |
|
#5
| |||
| |||
| Re: Trying equals with Map
Hello, Try replacing the following code with your code. Code: System.out.System.out.println("finn is |"+ finn +"| And is temp |"temp + +"|");
if(finn.equals(tmp)){
System.out.System.out.println("nm:"K + +- Date of discharge:+ deb);
}
else if(deb! =null Finn & &! =null){
System.out.System.out.println("nm:"K + +"- Start"+ + deb"End"+ finn);
}
else{
System.out.System.out.println("nm:"k + +"- Day of absence"+ Day);
} |
|
#6
| |||
| |||
| Re: Trying equals with Map
Hello, To see if the string is an empty string, the test is to Code: if ("".equals(finn)) {
} To determine if the finn string is null, the test is to Code: if (finn ==null) {
} |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Trying equals with Map" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| In Mafia wars Level 450 equals screwed | Dechen | Video Games | 4 | 13-02-2011 07:36 PM |
| Explain the difference between == & .equals methods in Java? | Harpreet Gaur | Software Development | 5 | 30-01-2010 11:36 AM |