Implement hash and isEqual: methods.

The java one always hashes a boolean if it's present then the value if it's set:

https://github.com/apache/thrift/blob/master/compiler/cpp/src/generate/t_java_generator.cc#L1857