Given a list of lists, and a number of new lists to add, copy the
    content of the first list into the new ones, and add them to the list
    of lists.
481110
def _grow(list_of_lists, num_new):
    
    first = list_of_lists[0]
    for i in range(num_new):
        list_of_lists.append(copy.deepcopy(first))
    return list_of_lists
827012
def merge(bedfiles):
    
    if isinstance(bedfiles, list):
        catted = concat(bedfiles)
    else:
        catted = concat([bedfiles])
    if catted:
        return concat(bedfiles).sort().merge()
    else:
        return catted
865936
def push(self, x):
        
        if isinstance(x, list):
            for item in x:
                self.stack.append(item)
        else:
            self.stack.append(x)
394887
def append(self, item):
        
        if item in self:
            self.items[item[0]].append(item[1])
        else:
            self.items[item[0]] = [item[1]]
706769
def add_set_of_points(self, points):
        
        self.set_of_points = np.concatenate((self.set_of_points, points))
456767
def substitution(self, substitution):
        
        if isinstance(substitution, list):
            for s in substitution:
                self.add_substitution(s)
        else:
            self.add_substitution(substitution)
511372
def extend_unique(list1, list2):
    """"""
    for item in list2:
        if item not in list1:
            list1.append(item)
1295509
def concat(lists):
    

    return lists[0].new(
        pd.concat([lists.data for lists in lists]).drop_duplicates()
    )
11073
public <T> List<T> cloneList(List<T> list) {
        return new ArrayList<T>(list);
    }
472929
def _append(lst, indices, value):
    
    for i, idx in enumerate(indices):
        # We need to loop because sometimes indices can increment by more than 1 due to missing tokens.
        # Example: Sentence with no words after filtering words.
        while len(lst) <= idx:
            # Update max counts whenever a new sublist is created.
            # There is no need to worry about indices beyond `i` since they will end up creating new lists as well.
            lst.append([])
        lst = lst[idx]

    # Add token and update token max count.
    lst.append(value)
627979
def _listify(collection):
        """"""
        new_list = []
        for index in range(len(collection)):
            new_list.append(collection[index])
        return new_list
200191
def _put_many(self, items):
        ''' 
        '''
        for item in items:
            if not isinstance(item, self._item_class):
                raise RuntimeError('Items mismatch for %s and %s' % (self._item_class, type(item)))
            self._put_one(item)
759005
def merge_lists(dest, source, extend_lists=False):
    
    if not source:
        return
    if not extend_lists:
        # Make them the same size
        left = dest
        right = source[:]
        if len(dest) > len(source):
            right.extend([None] * (len(dest) - len(source)))
        elif len(dest) < len(source):
            left.extend([None] * (len(source) - len(dest)))
        # Merge lists
        for index, value in enumerate(left):
            if value is None and right[index] is not None:
                dest[index] = right[index]
            elif isinstance(value, dict) and isinstance(right[index], dict):
                merge_dictionary(dest[index], source[index],
                                 extend_lists=extend_lists)
            elif isinstance(value, list):
                merge_lists(value, right[index])
            elif right[index] is not None:
                dest[index] = right[index]
    else:
        dest.extend([src for src in source if src not in dest])
    return dest
1258301
public static <T> List<T> concat(List<List<T>> lists) {
        List<T> list = new ArrayList<T>();
        for (List<? extends T> l : lists) {
            list.addAll(l);
        }
        return list;
    }
650308
private void copy() {
        if (elems.nonEmpty()) {
            List<A> orig = elems;

            elems = last = List.of(orig.head);

            while ((orig = orig.tail).nonEmpty()) {
                last.tail = List.of(orig.head);
                last = last.tail;
            }
        }
    }
1195559
def add(self, val):
        """"""
        _lists = self._lists
        _keys = self._keys
        _maxes = self._maxes

        key = self._key(val)

        if _maxes:
            pos = bisect_right(_maxes, key)

            if pos == len(_maxes):
                pos -= 1
                _lists[pos].append(val)
                _keys[pos].append(key)
                _maxes[pos] = key
            else:
                idx = bisect_right(_keys[pos], key)
                _lists[pos].insert(idx, val)
                _keys[pos].insert(idx, key)

            self._expand(pos)
        else:
            _lists.append([val])
            _keys.append([key])
            _maxes.append(key)

        self._len += 1
781146
def append_elements(self, elements):
        
        self._elements = self._elements + list(elements)
        self._on_element_change()