[Java] Shallow equality on `Table`
I have a situation where:
- I have a flatbuffer input that may be a DAG (i.e. table entries may be referenced multiple times in the input)
- I want to compute something for every node (i.e. each table entry) in the DAG
- I want to cache that computation, such that if a table entry is referenced multiple times I only do the computation for that object once.
But FlatBuffers does not seem to have a way of identifying when two instances actually refer to the same underlying data, so this isn't really possible right now.
Note that I do not want deep equality here, as that would mean quadratic time complexity where shallow would be linear.
I think something like shallowEquals on Table could make sense to support such a use case. Basically just checking if bb_pos, vtable_start, vtable_size are equal and bb references the same byte buffer.
shallowHashCode could likewise be implemented to support it being used in a hashmap.
I'm willing to make a PR if this approach seems sensible.
.
This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.
This issue was automatically closed due to no activity for 6 months plus the 14 day notice period.