Created
June 26, 2015 22:08
-
-
Save chinmaygarde/b5ef23f9998665d37e9c to your computer and use it in GitHub Desktop.
HashCodeBuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HashCodeBuilder { | |
int code = 1; | |
static const int hashPrime = 31; | |
HashCodeBuilder append(o) => this..code = (hashPrime * code) + o.hashCode; | |
} | |
void main() { | |
print((new HashCodeBuilder()).append(true).append(12.0).code); | |
print((new HashCodeBuilder()).append(true).append(12.0).code); | |
print((new HashCodeBuilder()).append(12.0).append(true).code); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment