Cache and reuse dependency objects

This pull request makes dependency objects immutable. This means, among other things, that it is safe to cache and reuse these objects instead of making DependencyCollector instances repeat work that has already been done for another formula.

On my machine, this improves the runtime of  `brew readall` by between one and two tenths of a second on average (warm cache, only core formulae):

Before:
```
real 0m1.853s
user 0m1.485s
sys  0m0.169s
```

After:

```
real 0m1.658s
user 0m1.295s
sys  0m0.169s
```