Closed xxDark closed 2 years ago
Those are methods that are very specific to array-based lists. It is however possible to add such methods using default methods. Wanna try a PR?
void getElements(int from, Object a[], int offset, int length);
This is equivalent to List.subList(from, from + length)
and copying into a
, right? (with the minimal overhead of creating a ListView
object).
void removeElements(int from, int to);
I propose removeAll(int from, int to)
as name (consistency)
void addElements(int index, K a[]);
void addElements(int index, K a[], int offset, int length);
Instead of passing arrays, it would be better to wrap the arrays as a List, Arrays.asList
etc. (very cheap, much cheaper than inserting in the middle of an array). Then you can use the standard method addAll(int index, Collection<K> collection)
. That implementation can then specifically handle arrays lists.
Well, those methods are already in the list interface.
Hello. I wonder if it is possible to introduce common interface for Lists, that might include:
and so on. Thanks in advance.