Craig P. Motlin

Results 152 comments of Craig P. Motlin

Updated the example wrapper to implement MutableList. For some reason, I had to implement just one more method, addAll.

I implemented sublist() just to get the wrapper compiling, by delegating to the primitive sublist and then boxing that. I realized afterwards that it won't work anyway because the implementation...

I see what you mean. I had started with List and AbstractList which don't give an implementation of subList(). It's actually easier to implement MutableList than List. Here's the new...

@s5bug If you really want a boxed collection, we already have a decent way to perform that with collect(). ```java MutableList boxed = IntLists.mutable.with(1, 2, 3).collect(each -> each); ``` Sorry...

That's a really good point about maps - I don't think we have any form of collect() or any other method that will created object Maps. Once we do support...

Hash tables can be compacted if the backing array is bigger than necessary. I can think of two cases where this happens. - We remove elements from a mutable hash...

I see what you mean. `ImmutableUnifiedSet.newSetWith(T... elements)` delegates to `UnifiedSet.newSetWith(T... elements)` which pre-sizes the table to `elements.length` without knowing whether there are duplicates. The implementation of `ImmutableUnifiedSet.newSetWith(T...)` or the `ImmutableUnifiedSet`...

The select/reject methods usually return the same type, filtered down. The collect methods usually return a different type. I don't really see this as inconsistent. I definitely think we should...

the topOccurrences() method has an inefficient implementation that ought to be optimized. The current implementation sorts, as you said, making it O(n log n). The [selection algorithm](https://en.wikipedia.org/wiki/Selection_algorithm) is O(n) and...

I took a look at Python's `most_common` and it takes the front element from a heap k times, making it O(n * k). This is a nice compromise in that...