vigna / fastutil

fastutil extends the Java™ Collections Framework by providing type-specific maps, sets, lists and queues.
Apache License 2.0
1.76k stars 196 forks source link

Sub list for immutable list #226

Closed techsy730 closed 3 years ago

techsy730 commented 3 years ago

Add a fast subList for ImmutableList.

Currently ImmutableList.subList doesn't return an ImmutableList itself due to the current implementation of ImmutableList being closely tied to the idea the full array is the whole list. This may change in a future release. Fixes https://github.com/vigna/fastutil/issues/223

Also applies some of the optimizations conceived for ImmutableList.subList to ArrayList.subList

vigna commented 3 years ago

Mmmmhhh... I think I shouldn't have merged the other one, right?

techsy730 commented 3 years ago

Mmmmhhh... I think I shouldn't have merged the other one, right?

Nah, I need to update it anyways to use KEYS_USE_REFERENCE_EQUALITY, so this is fine

vigna commented 3 years ago

Is this ready for merge?

techsy730 commented 3 years ago

Is this ready for merge?

Yeah, I'm content with it now.

vigna commented 3 years ago

Mmmh... testEquals_AnotherImmutableList() fails tho.

techsy730 commented 3 years ago

Strange, it passes on my machine.

vigna commented 3 years ago

OK, maybe there was some problem with the incremental build. I'll clean everything and start from scratch...

vigna commented 3 years ago

It's all OK—false alarm.