Nickolas Jennings wrote:Mike Cox,
Your solution definitely helped me, but it has a problem. When you have this magical function that finds added/removed pins how does it not include 'changed' pins. Feel free to reference my mock table below: There is no way to check a modification vs an addition/removal (That I know even if I'm just eyeing the data versus java calculating it). It's impossible to check for changes since there is no unique key that can be compared across the two connectors.
Nickolas Jennings wrote:I have two ArrayList<Object> and I want to be able to compare the differences.
Below is the code I'm using. This determines whether there are pinDifferences as a flag and a string. The string and flag are then passed to a jsp to print out. (This is in a service.) The problem I'm running into is if the pins are identical (1-17) but the second one has two options for pin #3. I'm printing out that pin 3-18 are different. Because I've sorted it. What I want to do is show that pin #3 doesn't exist on the other connector....
Winston Gutkowski wrote:(....)
If I'm right, then two Pins should be "equal" if their IDs (or "numbers") are equal, and two Connectors should be equal if:
(a) They have the same number of Pins.
(b) The Pins in every "position" (probably an index to an internal array or List) are "equal".
Piet Souris wrote:But since a pin is defined by all its fields, this wouldn't hold anyway.
So my conclusion is that I do not understand the topic well enough to say anything smart about it.