I'll try to explain my problem as clear as possible :). I am using PropertyChangeSupport to notify registered views for changes in the properties. One of the property is an object which properties are changed every view seconds. I don't want to create for this particular object new instance every time it is being updated (for the propertychangelistener to notice the change), so I wrote my own equals method where I ommit the comparation to itself.
@Override
public boolean equals(Object item) {
// do not compare
// if (this == item) { return true; }
if (!(item instanceof TransferQueueItem) ||
item == null) {
return false;
}
TransferQueueItem newItem = (TransferQueueItem) item;
boolean value =
// ommited... properties comparation
return value;
}
Unfortunatelly that doesn't have the effect I was looking for. If I create a copy of the object and fire the property change method on it, then it works fine.
What am I missing here?
-- Edit
I realized, that since I am using the same instance and not a copy of it, the properties are pointig the same place, thus the comparation would always come out true. Is there a workaround to that (besides creating a copy). Or how bad is to create a copy of an object every second, eg.