
Feb. 12, 2010
11:33 p.m.
Masklinn wrote:
Though I'm not sure it's a very good idea for lists. Semantically, lists are to be iterated, not really to be indexed.
I don't think I agree that lists are meant primarily for iteration. Indexing them is a perfectly legitimate and useful thing to do. However, I would agree that a list.get() operation with a default seems to be a rather rare requirement. Usually when you index a list, the index is generated by some algorithm that guarantees it's within range. I can't remember ever wanting a list.get() myself, and if I ever did, I would be quite happy to write my own. -- Greg