vigna / fastutil

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

*MappedBigList should implement a FlyweightPrototype interface #277

Open seirl opened 2 years ago

seirl commented 2 years ago

Currently there is no way to check dynamically if an BigList implements copy() or not. If all the MappedBigList implemented FlyweightPrototype, it would be easier to make a function that makes a threadsafe copy of any type of BigList.

Unfortunately FlyweightPrototype is in dsiutils, not fastutil, so I don't know what's the best way to proceed here.

vigna commented 2 years ago

Well, it's a one-time thing, so one not using reflection? I realize the copy() might not be lightweight. But which other cases would you need to cover (except Mapped vs. non-Mapped)?