Stdlib feedback

I've been going through the standard library and have some feedback.

There are a number of methods that are common across List<T>, Collection<T>, Iterable<T>, Array<T>, *Array, Iterator<T> etc.

I noticed some differences, so I made a spreadsheet: https://docs.google.com/spreadsheet/ccc?key=0Aq-5U2bpBIskdDdWdkNjaE55dDFtU3h5NXI1VF9Mc0E

Most of the gaps are expected (e.g. not having toArray on Array classes). There were some interesting differences, mostly on Iterator<T>:

  • Iterator<T> could have the following methods: contains, notEmpty, dropWhile, last, mapTo, sort, sortBy, toSortedList, withIndices
  • Iterator<T> has these additional methods, which the others could have: toLinkedSet, toHashSet, toArrayList

Separately, I think it would be useful for ImmutableArrayListBuilder’s add method to be fluent i.e. public fun add(item: T): ImmutableArrayListBuilder<T>. It would also be handy to have an addAll(Iterable<T> iterable): ImmutableArrayListBuilder<T> on ImmutableArrayListBuilder. I’d be happy to contribute this.

Thanks for your feedback. It's very useful!