implode method

List<E> implode(
  1. E item
)

Implementation

List<E> implode(E item) {
  if (length < 2) {
    return this;
  }

  int currentLength = length;
  int currentIndex = 1;

  for (int i = 0; i < currentLength - 1; i++) {
    insert(currentIndex + i, item);

    currentIndex += 1;
  }

  return this;
}