Hi,
I am having trouble figuring out how to compare each individual value of the ArrayList. I do this by assigning an empty ArrayList before the ArrayList I am about fill in but for some reason it fills both at the same time when I run the method. Do any of you have an idea why? Note: this code is not doing comparison but I can't fill them right in the first place to attempt to do comparison.
Code:
List<Long> StationsArrayListG7 = new ArrayList<>();
List<Long> StationsArrayListG7a = new ArrayList<>();
public void GetApplicationSpecificUserStats(MBeanServerConnection serverConnectionName) {
StationsArrayListG7a = StationsArrayListG7;
String attrName = "current";
for(String stringName : gSelectedApplicationsFromFile) {
try {
String connectsName = "WowzaMediaServerPro:vHosts=VHosts,vHostName=_defaultVHost_,"
+ "applications=Applications,applicationName=" + stringName + ",name=Connections";
ObjectName connectsObjName = new ObjectName(connectsName);
try {
Long valueObj = (Long)serverConnectionName.getAttribute(connectsObjName, attrName);
valueX = valueObj;
StationsArrayListG7.add(valueX);
} catch (MBeanException ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (AttributeNotFoundException ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstanceNotFoundException ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (ReflectionException ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
System.out.println("IOException Error has occured!");
}
}
catch (MalformedObjectNameException ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
When I do it with individual variable instead of array it works fine. I can't figure it out if I am doing it right assigning array
StationsArrayListG7a = StationsArrayListG7;. I tried copy and stuff like that but it kept giving me null.
Thanks in advance.