code: private void writeSequenceBegin(int size) throws TException {
          getCurrentContext().write();
          if (getCurrentContext().isMapKey()) {
              throw new TException(SEQUENCE_AS_KEY_ILLEGAL);
          }
          pushContext(new SequenceContext(null));
  
          try {
              getCurrentWriter().writeStartArray();
          } catch (IOException ex) {
              throw new TTransportException(ex);
          }
      }
docs: Helper shared by write{List/Set}Begin.