refactor: rename variable boolean 'b' to 'isEndOfPair' in CookieList.toString()

This commit is contained in:
Aditya Purohit 2023-11-19 09:11:32 -04:00
parent 5c4a7a1b1f
commit 097a401f3f

View File

@ -46,19 +46,19 @@ public class CookieList {
* @throws JSONException if a called function fails * @throws JSONException if a called function fails
*/ */
public static String toString(JSONObject jo) throws JSONException { public static String toString(JSONObject jo) throws JSONException {
boolean b = false; boolean isEndOfPair = false;
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
// Don't use the new entrySet API to maintain Android support // Don't use the new entrySet API to maintain Android support
for (final String key : jo.keySet()) { for (final String key : jo.keySet()) {
final Object value = jo.opt(key); final Object value = jo.opt(key);
if (!JSONObject.NULL.equals(value)) { if (!JSONObject.NULL.equals(value)) {
if (b) { if (isEndOfPair) {
sb.append(';'); sb.append(';');
} }
sb.append(Cookie.escape(key)); sb.append(Cookie.escape(key));
sb.append("="); sb.append("=");
sb.append(Cookie.escape(value.toString())); sb.append(Cookie.escape(value.toString()));
b = true; isEndOfPair = true;
} }
} }
return sb.toString(); return sb.toString();