My containsKey in hashmap is giving false value
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bandita_Pradhan
Posted On:   Friday, October 10, 2008 01:33 PM

Hi, I have following codes with HaspMap . But, my containskey is returning false. Not sure why? private HashMap methodThLabel_ = new HashMap (); ..............Some codes here MBeanThresholdLabel label = new MBeanThresholdLabel(); MBeanThresholdLabel nameValueO = new MBeanThresholdLabel(); nameValueO.setThName(name); nameValueO.setThValue(tmpValue3); if (methodThLabel_.containsKey(nameValueO)) { System.out.println("YYYYYYYYYY"); methodThLabel = methodThLabel_.get(nameValueO); System.out.println("methodThLabel is XXXXXX    More>>

Hi,

I have following codes with HaspMap . But, my containskey is returning false. Not sure why?

private HashMap methodThLabel_ = new HashMap ();

..............Some codes here



MBeanThresholdLabel label = new MBeanThresholdLabel();
MBeanThresholdLabel nameValueO = new MBeanThresholdLabel();
nameValueO.setThName(name);
nameValueO.setThValue(tmpValue3);


if (methodThLabel_.containsKey(nameValueO)) {
System.out.println("YYYYYYYYYY");
methodThLabel = methodThLabel_.get(nameValueO);
System.out.println("methodThLabel is XXXXXX " + methodThLabel);

}

MBeanMethod method = new MBeanMethod(name,object,methodValueThreshold_, methodThLabel, tmpValue3);

if ( (methodValueThreshold_ != 0L)) {
String baseFilename = createBaseFileName();
method.writeSample( fileName,baseFilename, outputDir, firstSample, sampleTime);
}

label.setThName(name);
label.setThValue(tmpValue3);

methodThLabel_.put(label, method.getMethodThresholdLabel());


I have code for MBeanThresholdLabel.

package com.hp.ov.nms.internal.perfCollect;

public class MBeanThresholdLabel {

private String th_name;
private String th_value;

public MBeanThresholdLabel() {}

public void setThName( String rhs ) { th_name = rhs; }
public void setThValue( String rhs ) { th_value = rhs; }

public String getThName() {
return th_name;
}

public String getThValue() {
return th_value;
}

public String toString() {
return th_name + th_value ;
}
}

Thanks,
Bandita

   <<Less
About | Sitemap | Contact