Implement equality and hashcode in IndexedValue

add index to hashcode