저는 프로그래밍 프로젝트를 진행하면서 일부 객체를 목록에 저장하려고하지만 중복을 제거 할 수 없습니다. 목록에 중복 객체가 있습니다.
이
내 오브젝트ND = nodeAddress16 = 0x10,0x03, nodeAddress64 = 0x00,0x13,0xa2,0x00,0x40,0x6f, 0x8d, 0xfc, RSSI = -47, nodeIdentifier = [0x10,0x03 인 ]
코드는 스레드 안에 있으므로 코드가 루핑됩니다. handleAtCommandResponse
이 같은 응답으로 여러 번 호출되는 이유를 확인하기 위해 시스템의 나머지 부분을 이해하지 않고
private void handleAtCommandResponse(XBeeResponse response) {
//TODO Implement your code here, to handle particular AT command responses, if desired.
System.out.println("NetworkNode: Received AT Response:"+((AtCommandResponse)response).getCommand());
if (response.getApiId() == ApiId.AT_RESPONSE) {
NodeDiscover nd = NodeDiscover.parse((AtCommandResponse)response);
System.out.println("Node discover response is: " + nd);
nodeDiscoverList.add(nd); //add to list, but gives duplicates of nd.
//add to list if not already in it
//if already in list replace that object with the new object
//duplicate objects are not allowed ==> only one object in the list can contain a specific address.
// Only addresses are static values, other values may change over time.
}
else {
log.debug("Ignoring unexpected response: " + response);
}
}