From 034f162d6d6bc411e79d5087601ad2f19c8f3d56 Mon Sep 17 00:00:00 2001 From: Avner Date: Fri, 5 May 2017 08:52:47 -0700 Subject: [PATCH] Typo in the comparison Summary: Issue fixed: # - [ ] All tests pass. Demo project builds and runs. - [ ] I added tests, an experiment, or detailed why my change isn't tested. - [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. - [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Closes https://github.com/Instagram/IGListKit/pull/716 Reviewed By: rnystrom Differential Revision: D5003529 Pulled By: jessesquires fbshipit-source-id: e7a0bdcff962f94c33f24f27e1fc9c0a3ed8dbfb --- Guides/IGListDiffable and Equality.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Guides/IGListDiffable and Equality.md b/Guides/IGListDiffable and Equality.md index ec897099..8a46a53f 100644 --- a/Guides/IGListDiffable and Equality.md +++ b/Guides/IGListDiffable and Equality.md @@ -33,7 +33,7 @@ Even though `IGListKit` uses the method `-isEqualToDiffableObject:`, the concept - If you override `-isEqual:` you **must** override `-hash`. Check out this [article by Mike Ash](https://www.mikeash.com/pyblog/friday-qa-2010-06-18-implementing-equality-and-hashing.html) for details. - Always compare the pointer first. This saves a lot of wasteful `objc_msgSend(...)` calls and value comparisons if checking the same instance. - When comparing object values, always check for `nil` before `-isEqual:`. For example, `[nil isEqual:nil]` unintuitively returns `NO`. Instead, do `left == right || [left isEqual:right]`. -- Always compare the **cheapest values first**. For example, doing `[self.array isEqual:other.array] && self.intVal == other.array` is extremely wasteful if the `intVal` values are different. Use lazy evaluation! +- Always compare the **cheapest values first**. For example, doing `[self.array isEqual:other.array] && self.intVal == other.intVal` is extremely wasteful if the `intVal` values are different. Use lazy evaluation! As an example, if I had a `User` model with the following interface: