I thought up a simple and efficient way to combine states with events to make event handling more efficient. My idea of state checking involves State objects that hold reference to mutable variables in an object.
I figure that using a sort of hashCode() for an Object and checking between the two states would be more efficient than iterating over the contents of a State object and comparing to the target state.
Problem is, hashCode() isn't calculated on a per-state basis. Is there some method similar to hashCode() that I can use to compare two states without comparing their contents directly and is cheap on CPU usage?
Edit: I didn't realize hashCode() is on a per-state basis.