shiftn method

void shiftn(
  1. T elem,
  2. int len
)

adds the elem to the end of this if n is given the first element is popped, if the list is longer than n

Implementation

void shiftn(T elem, int len) => (length >= len) ? shift(elem) : add(elem);