@Override
    public void write(final Kryo kryo, final Output output, final List<?> obj) {
      try {
        kryo.writeClassAndObject(output, _parentField.get(obj));
        final int parentOffset = _parentOffsetField.getInt( obj );
        final int fromIndex = parentOffset;
        output.writeInt(fromIndex, true);
        final int toIndex = fromIndex + _sizeField.getInt( obj );
        output.writeInt(toIndex, true);
      } catch (final RuntimeException e) {
        // Don't eat and wrap RuntimeExceptions because the ObjectBuffer.write...
        // handles SerializationException specifically (resizing the buffer)...
        throw e;
      } catch (final Exception e) {
        throw new RuntimeException(e);
      }
    }
Supports sublists created via {@link ArrayList#subList(int, int)} since java7 and {@link LinkedList#subList(int, int)} since java9 (openjdk).
This is from kryo-serializers package.
ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java