code: public static Object repeat(List<Object> list, int times) {
          if ( times < 1 )
              if (list instanceof Queue)
                  return new LinkedList<>();
              else
                  return new ArrayList<>(0);
          List<Object> lst = list instanceof Queue
                              ? new LinkedList<>(list)
                              : new ArrayList<>(list);
          if ( times == 1 )
              return lst;
          while ( times-- > 1 )
              lst.addAll(list);
          return lst;
      }
docs: Repeat the contents of a list a number of times.
  @param list the list to repeat
  @param times number of repetitions
  @return a new list instance with repeated contents