code: public String encode(Iterable<? extends Cookie> cookies) {
          Iterator<? extends Cookie> cookiesIt = checkNotNull(cookies, "cookies").iterator();
          if (!cookiesIt.hasNext()) {
              return null;
          }
  
          StringBuilder buf = stringBuilder();
          if (strict) {
              Cookie firstCookie = cookiesIt.next();
              if (!cookiesIt.hasNext()) {
                  encode(buf, firstCookie);
              } else {
                  List<Cookie> cookiesList = InternalThreadLocalMap.get().arrayList();
                  cookiesList.add(firstCookie);
                  while (cookiesIt.hasNext()) {
                      cookiesList.add(cookiesIt.next());
                  }
                  Cookie[] cookiesSorted = cookiesList.toArray(new Cookie[0]);
                  Arrays.sort(cookiesSorted, COOKIE_COMPARATOR);
                  for (Cookie c : cookiesSorted) {
                      encode(buf, c);
                  }
              }
          } else {
              while (cookiesIt.hasNext()) {
                  encode(buf, cookiesIt.next());
              }
          }
          return stripTrailingSeparatorOrNull(buf);
      }
docs: Encodes the specified cookies into a single Cookie header value.
  
  @param cookies some cookies
  @return a Rfc6265 style Cookie header value, null if no cookies are passed.