code: public List<String> encode(Iterable<? extends Cookie> cookies) {
          Iterator<? extends Cookie> cookiesIt = checkNotNull(cookies, "cookies").iterator();
          if (!cookiesIt.hasNext()) {
              return Collections.emptyList();
          }
  
          List<String> encoded = new ArrayList<String>();
          Cookie firstCookie = cookiesIt.next();
          Map<String, Integer> nameToIndex = strict && cookiesIt.hasNext() ? new HashMap<String, Integer>() : null;
          int i = 0;
          encoded.add(encode(firstCookie));
          boolean hasDupdName = nameToIndex != null && nameToIndex.put(firstCookie.name(), i++) != null;
          while (cookiesIt.hasNext()) {
              Cookie c = cookiesIt.next();
              encoded.add(encode(c));
              if (nameToIndex != null) {
                  hasDupdName |= nameToIndex.put(c.name(), i++) != null;
              }
          }
          return hasDupdName ? dedup(encoded, nameToIndex) : encoded;
      }
docs: Batch encodes cookies into Set-Cookie header values.
  
  @param cookies a bunch of cookies
  @return the corresponding bunch of Set-Cookie headers