Skip to content

Commit

Permalink
LinkedHashMap 替换 HashMap, 因为LinkedHashMap是有序的
Browse files Browse the repository at this point in the history
  • Loading branch information
mxvc committed Dec 2, 2024
1 parent ea12558 commit 3325c6b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "cn.moon.ql"
minSdk 24
targetSdk 33
versionCode 107
versionName "1.0.7"
versionCode 108
versionName "1.0.8"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
8 changes: 3 additions & 5 deletions app/src/main/java/cn/moon/ql/util/CookieUtil.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package cn.moon.ql.util;

import android.text.TextUtils;
import android.webkit.CookieManager;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

Expand All @@ -14,7 +12,7 @@ public class CookieUtil {
public static Map<String, String> parse(String cookies) {
String[] cookiesArr = cookies.split(";");

Map<String, String> map = new HashMap<>();
Map<String, String> map = new LinkedHashMap<>();
for (String ck : cookiesArr) {
String[] arr = ck.split("=");
if (arr.length == 2) {
Expand All @@ -35,7 +33,7 @@ public static Map<String, String> parse(String cookies) {
public static Map<String, String> parse(String cookies,String... keys) {
Map<String, String> map = parse(cookies);

Map<String,String> newMap = new HashMap<>();
Map<String,String> newMap = new LinkedHashMap<>();
for (String key : keys) {
String value = map.get(key);
if(!TextUtils.isEmpty(value)){
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
android:id="@+id/ql_env_name"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:hint="变量名"
android:hint="自定义变量名"
android:inputType="text"
/>

Expand Down

0 comments on commit 3325c6b

Please sign in to comment.