code: public static <T> List<List<T>> splitList(List<T> _list, int _elements) {
         List<List<T>> partitions = new ArrayList<>();
         for (int i = 0; i < _list.size(); i += _elements) {
             partitions.add(_list.subList(i,
                     Math.min(i + _elements, _list.size())));
         }
  
         return partitions;
     }
docs: Split a List into equal parts.
  Last list could be shorter than _elements.
  
  @param _list list to split
  @param _elements elements per list
  @param <T> type
  @return list of lists