Compare commits
26 Commits
10e6dbf415
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| dadf47f151 | |||
| ad72033f7e | |||
| f86b055ecb | |||
| 2235c45510 | |||
| d4dd16ef96 | |||
| 301a8b3911 | |||
| ba50b612d8 | |||
| f251d5601a | |||
| 21a23ee07e | |||
| a91655bac5 | |||
| c665ca3b1f | |||
| c1da2bd955 | |||
| e298c3a1a5 | |||
| 5edfe37a46 | |||
| 81c9ce2995 | |||
| 545e3df7c0 | |||
| 4160b02787 | |||
| fe1d9d913c | |||
| 166fe7fe9a | |||
| aaccb2114b | |||
| b7da6e9537 | |||
| 1b2a33d72d | |||
| bbd5275855 | |||
| b254db3bc0 | |||
| e575b8b94b | |||
| 850c0d3dc3 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -7,9 +7,10 @@
|
||||
target
|
||||
*.project
|
||||
*.classpath
|
||||
/.settings
|
||||
**/.settings
|
||||
/bin
|
||||
/useful-code.iml
|
||||
/.idea
|
||||
/resources/debug.log
|
||||
*.iml
|
||||
*.iml
|
||||
budd-common/.settings
|
||||
|
||||
@@ -9,4 +9,4 @@
|
||||
|
||||
## Thanks to the following organizations for providing open source licenses
|
||||
|
||||
[<img src="https://cdn.ehlxr.top/jetbrains.png" width = "200" height = "217" alt="图片名称" align=center />](https://jb.gg/OpenSource)
|
||||
[<img src="https://github.com/ehlxr/budd/blob/master/jetbrains.svg" width = "200" height = "217" alt="jetbrains" align=center />](https://jb.gg/OpenSource)
|
||||
|
||||
@@ -40,4 +40,16 @@
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>9</source>
|
||||
<target>9</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2022 xrv <xrv@live.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package io.github.ehlxr.algorithm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ehlxr
|
||||
* @since 2022-04-29 11:07.
|
||||
*/
|
||||
public class MinWindow {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(minWindow("cabwefgewcwaefgcf", "cae"));
|
||||
System.out.println(minWindow("bba", "ab"));
|
||||
System.out.println(minWindow("ADOBECODEBANC", "ABC"));
|
||||
System.out.println(minWindow("a", "a"));
|
||||
System.out.println(minWindow("a", "b"));
|
||||
System.out.println(minWindow("", "a"));
|
||||
System.out.println(minWindow("", ""));
|
||||
System.out.println(minWindow("a", "aa"));
|
||||
System.out.println(minWindow("aa", "a"));
|
||||
}
|
||||
|
||||
public static String minWindow(String s, String t) {
|
||||
Map<Character, Integer> windows = new HashMap<>();
|
||||
Map<Character, Integer> needs = new HashMap<>();
|
||||
for (int i = 0; i < t.length(); i++) {
|
||||
needs.put(t.charAt(i), needs.getOrDefault(t.charAt(i), 0) + 1);
|
||||
}
|
||||
|
||||
int left = 0, right = 0, valid = 0, start = -1, len = Integer.MAX_VALUE;
|
||||
while (right < s.length()) {
|
||||
char r = s.charAt(right);
|
||||
|
||||
if (needs.containsKey(r)) {
|
||||
windows.put(r, windows.getOrDefault(r, 0) + 1);
|
||||
if (windows.get(r).equals(needs.get(r))) {
|
||||
valid++;
|
||||
}
|
||||
}
|
||||
right++;
|
||||
|
||||
while (valid == needs.size()) {
|
||||
if (right - left < len) {
|
||||
len = right - left;
|
||||
start = left;
|
||||
}
|
||||
|
||||
char l = s.charAt(left);
|
||||
left++;
|
||||
|
||||
if (windows.containsKey(l)) {
|
||||
if (windows.get(l).equals(needs.get(l))) {
|
||||
valid--;
|
||||
}
|
||||
windows.put(l, windows.get(l) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return start > -1 ? s.substring(start, start + len) : "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2022 xrv <xrv@live.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package io.github.ehlxr.algorithm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 全排列
|
||||
*
|
||||
* @author ehlxr
|
||||
* @since 2022-04-20 16:42.
|
||||
*/
|
||||
public class Permutation {
|
||||
static List<List<Integer>> res = new ArrayList<>();
|
||||
|
||||
public static void main(String[] args) {
|
||||
int[] arr = {1, 2, 3};
|
||||
for (List<Integer> r : permute(arr)) {
|
||||
for (int i : r) {
|
||||
System.out.print(i + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<List<Integer>> permute(int[] nums) {
|
||||
List<Integer> track = new ArrayList<>();
|
||||
backtrack(nums, track);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void backtrack(int[] nums, List<Integer> track) {
|
||||
// 回溯结束条件
|
||||
if (track.size() == nums.length) {
|
||||
res.add(new ArrayList<>(track));
|
||||
return;
|
||||
}
|
||||
for (int num : nums) {
|
||||
if (track.contains(num)) {
|
||||
continue;
|
||||
}
|
||||
track.add(num);
|
||||
backtrack(nums, track);
|
||||
track.remove(track.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,26 +31,74 @@ import java.util.Arrays;
|
||||
* @since 2022-03-15 07:40.
|
||||
*/
|
||||
public class Heap {
|
||||
private static void createHeap(int[] a) {
|
||||
int n = a.length - 1; // 最后一个叶子节点下标
|
||||
buildHeap(a, n);
|
||||
}
|
||||
|
||||
private static void buildHeap(int[] a, int n) {
|
||||
// (n - 1) / 2 表示最后一个叶子节点父节点,即为最后一个非叶子节点
|
||||
for (int i = (n - 1) / 2; i >= 0; --i) {
|
||||
heapify(a, n, i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 堆化
|
||||
*
|
||||
* @param a 数组
|
||||
* @param n 最后一个元素下标
|
||||
* @param i 需要调整的父节点下标
|
||||
*/
|
||||
private static void heapify(int[] a, int n, int i) {
|
||||
while (true) {
|
||||
int max = i;
|
||||
|
||||
// 从当前节点和左右叶子节点中找出最大的
|
||||
int l = 2 * i + 1;
|
||||
if (l <= n && a[l] > a[max]) {
|
||||
max = l;
|
||||
}
|
||||
|
||||
int r = 2 * i + 2;
|
||||
if (r <= n && a[r] > a[max]) {
|
||||
max = r;
|
||||
}
|
||||
|
||||
// 当前节点最大时退出
|
||||
if (max == i) {
|
||||
break;
|
||||
}
|
||||
|
||||
swap(a, i, max);
|
||||
|
||||
// 最大节点和当前节点交换后,继续以当前节点为父节点堆化
|
||||
i = max;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 堆排序
|
||||
*/
|
||||
private static void sort(int[] a) {
|
||||
for (int i = a.length - 1; i > 0; i--) {
|
||||
buildHeap(a, i);
|
||||
// 堆顶元素和最后一个元素交换,除过最后一个元素外其它元素再次构建大顶堆
|
||||
swap(a, 0, i);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int[] arr = new int[]{1, 2, 3, 4, 5, 6};
|
||||
createHeap(arr);
|
||||
System.out.println(Arrays.toString(arr));
|
||||
sweap(arr,2,3);
|
||||
|
||||
sort(arr);
|
||||
System.out.println(Arrays.toString(arr));
|
||||
|
||||
}
|
||||
|
||||
public static int[] heapify(int[] arr) {
|
||||
|
||||
for (int i = arr.length - 1; i > 0; i--) {
|
||||
if (arr[i] > arr[i / 2]) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void sweap(int[] arr, int i, int j) {
|
||||
private static void swap(int[] arr, int i, int j) {
|
||||
int tmp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = tmp;
|
||||
|
||||
@@ -30,20 +30,38 @@ package io.github.ehlxr.algorithm.dp;
|
||||
* @author ehlxr
|
||||
* @since 2022-03-05 14:31.
|
||||
*/
|
||||
public class KnapSack3 {
|
||||
public class KnapSack {
|
||||
private final int[] weight = {2, 2, 4, 6, 3}; // 物品的重量
|
||||
private final int[] value = {3, 4, 8, 9, 6}; // 物品的价值
|
||||
private final int n = 5; // 物品个数
|
||||
private final int w = 9; // 背包承受的最大重量
|
||||
private int maxV = Integer.MIN_VALUE; // 结果放到 maxV 中
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(knapsack3(new int[]{2, 2, 4, 6, 3}, new int[]{3, 4, 8, 9, 6}, 5, 9));
|
||||
// System.out.println(knapsack(new int[]{2, 2, 4, 6, 3}, new int[]{3, 4, 8, 9, 6}, 5, 9));
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态规划方式
|
||||
*
|
||||
* @param weight 物品重量
|
||||
* @param value 物品的价值
|
||||
* @param n: 物品个数
|
||||
* @param w: 背包可承载重量
|
||||
* @param n 物品个数
|
||||
* @param w 背包可承载重量
|
||||
* @return 最大价值
|
||||
*/
|
||||
// public static int knapsack(int[] weight, int[] value, int n, int w) {
|
||||
// int[][] dp = new int[][];
|
||||
// }
|
||||
|
||||
/**
|
||||
* 动态规划方式
|
||||
*
|
||||
* @param weight 物品重量
|
||||
* @param value 物品的价值
|
||||
* @param n 物品个数
|
||||
* @param w 背包可承载重量
|
||||
* @return 最大价值
|
||||
*/
|
||||
public static int knapsack3(int[] weight, int[] value, int n, int w) {
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2022 xrv <xrv@live.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package io.github.ehlxr.algorithm.linkedlist;
|
||||
|
||||
/**
|
||||
* @author ehlxr
|
||||
* @since 2022-05-01 14:18.
|
||||
*/
|
||||
public class FindKthFromEnd {
|
||||
public static void main(String[] args) {
|
||||
ListNode head = new ListNode(1);
|
||||
head.next = new ListNode(2);
|
||||
head.next.next = new ListNode(3);
|
||||
head.next.next.next = new ListNode(4);
|
||||
head.next.next.next.next = new ListNode(5);
|
||||
head.next.next.next.next.next = new ListNode(6);
|
||||
|
||||
System.out.println(head);
|
||||
|
||||
System.out.println(findKthFromEnd(head, 1));
|
||||
System.out.println(findKthFromEnd2(head, 1));
|
||||
}
|
||||
|
||||
public static ListNode findKthFromEnd(ListNode head, int k) {
|
||||
int n = 0;
|
||||
ListNode node = head;
|
||||
ListNode p = null;
|
||||
while (node != null) {
|
||||
if (p != null) {
|
||||
p = p.next;
|
||||
}
|
||||
|
||||
n++;
|
||||
if (n == k) {
|
||||
p = head;
|
||||
}
|
||||
|
||||
node = node.next;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
public static ListNode findKthFromEnd2(ListNode head, int k) {
|
||||
ListNode p = head;
|
||||
ListNode q = head;
|
||||
for (int i = 0; i < k; i++) {
|
||||
q = q.next;
|
||||
}
|
||||
while (q != null) {
|
||||
p = p.next;
|
||||
q = q.next;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2020 xrv <xrg@live.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package io.github.ehlxr.algorithm.linkedlist;
|
||||
|
||||
/**
|
||||
* @author ehlxr
|
||||
* @since 2022-04-15 08:41.
|
||||
*/
|
||||
public class Leecode21 {
|
||||
public static void main(String[] args) {
|
||||
ListNode list1 = new ListNode(1);
|
||||
ListNode list2 = new ListNode(2);
|
||||
ListNode list3 = new ListNode(4);
|
||||
list1.next = list2;
|
||||
list2.next = list3;
|
||||
ListNode list4 = new ListNode(1);
|
||||
ListNode list5 = new ListNode(3);
|
||||
ListNode list6 = new ListNode(4);
|
||||
list4.next = list5;
|
||||
list5.next = list6;
|
||||
ListNode list7 = mergeTwoLists(list1, list4);
|
||||
while (list7 != null) {
|
||||
System.out.println(list7.val);
|
||||
list7 = list7.next;
|
||||
}
|
||||
}
|
||||
|
||||
public static ListNode mergeTwoLists(ListNode list1, ListNode list2) {
|
||||
ListNode res = new ListNode();
|
||||
ListNode tmp = res;
|
||||
|
||||
while (list1 != null || list2 != null) {
|
||||
if (list1 == null) {
|
||||
tmp.next = list2;
|
||||
break;
|
||||
}
|
||||
if (list2 == null) {
|
||||
tmp.next = list1;
|
||||
break;
|
||||
}
|
||||
if (list1.val < list2.val) {
|
||||
tmp.next = list1;
|
||||
list1 = list1.next;
|
||||
} else {
|
||||
tmp.next = list2;
|
||||
list2 = list2.next;
|
||||
}
|
||||
tmp = tmp.next;
|
||||
}
|
||||
|
||||
return res.next;
|
||||
}
|
||||
|
||||
public static ListNode mergeTwoLists2(ListNode l1, ListNode l2) {
|
||||
// 虚拟头结点
|
||||
ListNode dummy = new ListNode(-1), p = dummy;
|
||||
ListNode p1 = l1, p2 = l2;
|
||||
|
||||
while (p1 != null && p2 != null) {
|
||||
// 比较 p1 和 p2 两个指针
|
||||
// 将值较小的的节点接到 p 指针
|
||||
if (p1.val > p2.val) {
|
||||
p.next = p2;
|
||||
p2 = p2.next;
|
||||
} else {
|
||||
p.next = p1;
|
||||
p1 = p1.next;
|
||||
}
|
||||
// p 指针不断前进
|
||||
p = p.next;
|
||||
}
|
||||
|
||||
if (p1 != null) {
|
||||
p.next = p1;
|
||||
}
|
||||
|
||||
if (p2 != null) {
|
||||
p.next = p2;
|
||||
}
|
||||
|
||||
return dummy.next;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2022 xrv <xrv@live.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package io.github.ehlxr.algorithm.linkedlist;
|
||||
|
||||
/**
|
||||
* @author ehlxr
|
||||
* @since 2022-12-04 22:25.
|
||||
*/
|
||||
public class ListNode {
|
||||
int val;
|
||||
ListNode next;
|
||||
|
||||
ListNode() {
|
||||
}
|
||||
|
||||
ListNode(int val) {
|
||||
this.val = val;
|
||||
}
|
||||
|
||||
ListNode(int val, ListNode next) {
|
||||
this.val = val;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ListNode{" +
|
||||
"val=" + val +
|
||||
", next=" + next +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2022 xrv <xrv@live.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package io.github.ehlxr.algorithm.linkedlist;
|
||||
|
||||
/**
|
||||
* 判断单链表是否是回文
|
||||
*
|
||||
* @author ehlxr
|
||||
* @since 2022-12-03 23:11.
|
||||
*/
|
||||
public class Palindrome {
|
||||
public static void main(String[] args) {
|
||||
ListNode head = new ListNode(1);
|
||||
head.next = new ListNode(2);
|
||||
head.next.next = new ListNode(3);
|
||||
head.next.next.next = new ListNode(2);
|
||||
head.next.next.next.next = new ListNode(1);
|
||||
System.out.println(head);
|
||||
System.out.println(isPalindrome(head));
|
||||
|
||||
head = new ListNode(1);
|
||||
head.next = new ListNode(2);
|
||||
head.next.next = new ListNode(3);
|
||||
head.next.next.next = new ListNode(3);
|
||||
head.next.next.next.next = new ListNode(2);
|
||||
head.next.next.next.next.next = new ListNode(1);
|
||||
System.out.println(head);
|
||||
System.out.println(isPalindrome(head));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* slow, fast 双指针,slow 前进一步,fast 前进两步,当 fast 到达链表尾部时,slow 处于链表中间
|
||||
* 与此同时反转链表前半部分(head 到中间节点部分)
|
||||
*/
|
||||
public static boolean isPalindrome(ListNode head) {
|
||||
if (head == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ListNode slow = head, fast = head, pre = null;
|
||||
while (fast != null && fast.next != null) {
|
||||
fast = fast.next.next;
|
||||
|
||||
ListNode tmp = slow.next;
|
||||
slow.next = pre;
|
||||
pre = slow;
|
||||
slow = tmp;
|
||||
// slow = slow.next;
|
||||
}
|
||||
if (fast != null) {
|
||||
// 节点个数为奇数
|
||||
slow = slow.next;
|
||||
}
|
||||
System.out.println("中间节点:" + slow);
|
||||
System.out.println("中位点反转:" + pre);
|
||||
|
||||
while (pre != null) {
|
||||
if (pre.val != slow.val) {
|
||||
return false;
|
||||
}
|
||||
pre = pre.next;
|
||||
slow = slow.next;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2022 xrv <xrv@live.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package io.github.ehlxr.algorithm.linkedlist;
|
||||
|
||||
/**
|
||||
* @author ehlxr
|
||||
* @since 2022-05-03 14:26.
|
||||
*/
|
||||
public class ReverseKGroup {
|
||||
public static void main(String[] args) {
|
||||
ListNode head = new ListNode(1);
|
||||
head.next = new ListNode(2);
|
||||
head.next.next = new ListNode(3);
|
||||
head.next.next.next = new ListNode(4);
|
||||
head.next.next.next.next = new ListNode(5);
|
||||
System.out.println(head);
|
||||
System.out.println(reverseKGroup(head, 2));
|
||||
}
|
||||
|
||||
public static ListNode reverseKGroup(ListNode head, int k) {
|
||||
ListNode p = head;
|
||||
for (int i = 0; i < k; i++) {
|
||||
if (p == null) {
|
||||
return head;
|
||||
}
|
||||
p = p.next;
|
||||
}
|
||||
|
||||
ListNode r = reverseN(head, p);
|
||||
head.next = reverseKGroup(p, k);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ListNode reverseN(ListNode head, ListNode n) {
|
||||
ListNode cur = head, pre = null;
|
||||
while (cur != n) {
|
||||
ListNode next = cur.next;
|
||||
cur.next = pre;
|
||||
pre = cur;
|
||||
cur = next;
|
||||
}
|
||||
return pre;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,27 +32,63 @@ package io.github.ehlxr.algorithm.linkedlist;
|
||||
*/
|
||||
public class ReverseLinkedList {
|
||||
public static void main(String[] args) {
|
||||
Node node5 = new Node(5, null);
|
||||
Node node4 = new Node(4, node5);
|
||||
Node node3 = new Node(3, node4);
|
||||
Node node2 = new Node(2, node3);
|
||||
Node node1 = new Node(1, node2);
|
||||
Node node0 = new Node(0, node1);
|
||||
Node root = new Node(null, node0);
|
||||
ListNode ListNode5 = new ListNode(5, null);
|
||||
ListNode ListNode4 = new ListNode(4, ListNode5);
|
||||
ListNode ListNode3 = new ListNode(3, ListNode4);
|
||||
ListNode ListNode2 = new ListNode(2, ListNode3);
|
||||
ListNode head = new ListNode(1, ListNode2);
|
||||
|
||||
Node reverse = reverse(root);
|
||||
// root.print();
|
||||
// ListNode reverse = reverse(root);
|
||||
// reverse.print();
|
||||
|
||||
reverse.print();
|
||||
// System.out.println(reverseToN(head, ListNode3));
|
||||
// System.out.println(reverseToN(head, 2));
|
||||
System.out.println(reverseFm2N(head, 2, 4));
|
||||
|
||||
}
|
||||
|
||||
public static Node reverse(Node root) {
|
||||
public static ListNode reverseToN(ListNode root, ListNode n) {
|
||||
ListNode pre = null, cur = root, tmp = root;
|
||||
while (cur != n) {
|
||||
tmp = cur.next;
|
||||
|
||||
Node pre = null;
|
||||
Node cur = root;
|
||||
cur.next = pre;
|
||||
pre = cur;
|
||||
cur = tmp;
|
||||
}
|
||||
|
||||
return pre;
|
||||
|
||||
}
|
||||
|
||||
static ListNode next = null;
|
||||
|
||||
public static ListNode reverseToN(ListNode root, int n) {
|
||||
if (n == 1) {
|
||||
next = root.next;
|
||||
return root;
|
||||
}
|
||||
|
||||
ListNode h = reverseToN(root.next, n - 1);
|
||||
root.next.next = root;
|
||||
root.next = next;
|
||||
return h;
|
||||
}
|
||||
|
||||
public static ListNode reverseFm2N(ListNode root, int m, int n) {
|
||||
if (m == 1) {
|
||||
return reverseToN(root, n);
|
||||
}
|
||||
root.next = reverseFm2N(root.next, m - 1, n - 1);
|
||||
return root;
|
||||
}
|
||||
|
||||
public static ListNode reverse(ListNode root) {
|
||||
|
||||
ListNode pre = null;
|
||||
ListNode cur = root;
|
||||
while (cur != null) {
|
||||
Node tmp = cur.next;
|
||||
ListNode tmp = cur.next;
|
||||
|
||||
cur.next = pre;
|
||||
pre = cur;
|
||||
@@ -63,27 +99,3 @@ public class ReverseLinkedList {
|
||||
return pre;
|
||||
}
|
||||
}
|
||||
|
||||
class Node {
|
||||
public Integer value;
|
||||
public Node next;
|
||||
|
||||
public Node(Integer value, Node next) {
|
||||
this.next = next;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void print() {
|
||||
System.out.println(this);
|
||||
Node tmp = this.next;
|
||||
while (tmp != null) {
|
||||
System.out.println(tmp);
|
||||
tmp = tmp.next;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Node[value=" + this.value + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,20 +39,25 @@ public class BruteForce {
|
||||
}
|
||||
|
||||
public static int bf(String s, String p) {
|
||||
int sl = s.length();
|
||||
int pl = p.length();
|
||||
int m = s.length();
|
||||
int n = p.length();
|
||||
|
||||
for (int i = 0; i <= sl - pl; i++) {
|
||||
for (int i = 0; i <= m - n; i++) {
|
||||
int j = 0;
|
||||
for (; j < pl; j++) {
|
||||
if (s.charAt(i) == p.charAt(j)) {
|
||||
i++;
|
||||
} else {
|
||||
for (; j < n; j++) {
|
||||
// if (s.charAt(i) == p.charAt(j)) {
|
||||
// i++;
|
||||
// } else {
|
||||
// break;
|
||||
// }
|
||||
// 如果主串与模式串不匹配,则主串向右移动一个字符,模式串从头开始匹配
|
||||
if (s.charAt(i + j) != p.charAt(j)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == pl) {
|
||||
return i - pl;
|
||||
if (j == n) {
|
||||
// return i - n;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,15 +52,33 @@ public class Kmp {
|
||||
|
||||
for (int i = 0; i <= m - n; i++) {
|
||||
int j = 0;
|
||||
while (j < n) {
|
||||
if (scs[i] == pcs[j]) {
|
||||
i++;
|
||||
j++;
|
||||
} else {
|
||||
// 当模式串与主串不匹配时,如果**不匹配字符**对应模式串下标大于 j > 0 (非首个模式串字符),
|
||||
// 并且此字符前一个字符对应字符串部分匹配表中的值 next[j - 1] 也大于 0,
|
||||
// j - next[j - 1] 即模式串为后移的位数,等价于 j 置为 next[j - 1]
|
||||
// while (j < n) {
|
||||
// if (scs[i] == pcs[j]) {
|
||||
// i++;
|
||||
// j++;
|
||||
// } else {
|
||||
// // 当模式串与主串不匹配时,如果**不匹配字符**对应模式串下标大于 j > 0 (非首个模式串字符),
|
||||
// // 并且此字符前一个字符对应字符串部分匹配表中的值 next[j - 1] 也大于 0,
|
||||
// // j - next[j - 1] 即模式串为后移的位数,等价于 j 置为 next[j - 1]
|
||||
// if (j > 0 && next[j - 1] > 0) {
|
||||
// j = next[j - 1];
|
||||
// } else {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (j == n) {
|
||||
// return i - n;
|
||||
// }
|
||||
|
||||
for (; j < n; j++) {
|
||||
if (scs[i + j] != pcs[j]) {
|
||||
// 暴力匹配算法当模式串和主串不匹配时,主串匹配下标 +1,模式串匹配下标置为 0,
|
||||
// KMP 算法优化点在于将模式串下标置为不匹配字符前一个字符对应 next 数组的值
|
||||
if (j > 0 && next[j - 1] > 0) {
|
||||
// 当模式串与主串不匹配时,如果**不匹配字符**对应模式串下标大于 j > 0 (非首个模式串字符),
|
||||
// 并且此字符前一个字符对应字符串部分匹配表中的值 next[j - 1] 也大于 0,
|
||||
// j - next[j - 1] 即模式串为后移的位数,等价于 j 置为 next[j - 1]
|
||||
j = next[j - 1];
|
||||
} else {
|
||||
break;
|
||||
@@ -68,7 +86,7 @@ public class Kmp {
|
||||
}
|
||||
}
|
||||
if (j == n) {
|
||||
return i - n;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,15 +101,19 @@ public class Kmp {
|
||||
next[0] = 0;
|
||||
int k = 0; // 表示前后缀相匹配的最大长度
|
||||
|
||||
// 根据已知 next 数组的前 i-1 位推测第 i 位
|
||||
for (int i = 1; i < m; ++i) {
|
||||
// k 为 b[0, i-1] 子串最大匹配前、后缀长度
|
||||
// b[0, k] 为 b[0, i-1] 子串最大匹配前缀子串
|
||||
while (k != 0 && b[k] != b[i]) {
|
||||
// 若:b[k] != b[i],则求 b[0, i] 子串最大匹配前、后缀长度问题转换成了求 b[0, k] 子串最大匹配前、后缀长度问题
|
||||
// k 为 b[0, i) 子串最大匹配前后缀长度
|
||||
// b[0, k) 为 b[0, i) 子串最大匹配前缀子串
|
||||
|
||||
// 若:1、b[k] != b[i],则求 b[0, i] 子串最大匹配前后缀长度问题
|
||||
// 转换成了求 b[0, k) 子串最大匹配前后缀长度问题
|
||||
// 循环直到 b[k] == b[i] (下一步处理) 或 k == 0
|
||||
k = next[k];
|
||||
}
|
||||
// 若:2、b[k] == b[i],则 b[0, i] 子串最大匹配前后缀长度为 k + 1
|
||||
if (b[k] == b[i]) {
|
||||
// 若:b[k] == b[i],则 b[0, i] 子串最大匹配前、后缀长度为 k + 1
|
||||
++k;
|
||||
}
|
||||
next[i] = k;
|
||||
|
||||
@@ -34,6 +34,7 @@ public class MergeSort {
|
||||
public static void main(String[] args) {
|
||||
int[] arrs = new int[]{3, 2, 5, 7, 1, 9};
|
||||
System.out.println(Arrays.toString(sort(arrs)));
|
||||
System.out.println(Arrays.toString(sort2(arrs)));
|
||||
}
|
||||
|
||||
public static int[] sort(int[] arrs) {
|
||||
@@ -69,4 +70,42 @@ public class MergeSort {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static int[] sort2(int[] a) {
|
||||
if (a == null || a.length <= 1) {
|
||||
return a;
|
||||
}
|
||||
|
||||
return merge2(sort2(Arrays.copyOfRange(a, 0, a.length / 2)),
|
||||
sort2(Arrays.copyOfRange(a, a.length / 2, a.length)));
|
||||
}
|
||||
|
||||
public static int[] merge2(int[] a, int[] b) {
|
||||
int[] r = new int[a.length + b.length];
|
||||
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int m = 0;
|
||||
while (i < a.length || j < b.length) {
|
||||
if (i >= a.length) {
|
||||
r[m++] = b[j++];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (j >= b.length) {
|
||||
r[m++] = a[i++];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (a[i] < b[j]) {
|
||||
r[m++] = a[i++];
|
||||
} else {
|
||||
r[m++] = b[j++];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.Arrays;
|
||||
public class QuickSort {
|
||||
public static void main(String[] args) {
|
||||
int[] a = new int[]{3, 9, 5, 7, 1, 2};
|
||||
sort(a, 0, a.length - 1);
|
||||
sort2(a, 0, a.length - 1);
|
||||
|
||||
System.out.println(Arrays.toString(a));
|
||||
}
|
||||
@@ -85,5 +85,32 @@ public class QuickSort {
|
||||
a[j] = temp;
|
||||
}
|
||||
|
||||
public static void sort2(int[] a, int l, int r) {
|
||||
if (a == null || l >= r) {
|
||||
return;
|
||||
}
|
||||
|
||||
int i = l, j = r;
|
||||
int p = l; // 选择最左边的元素为 pivot
|
||||
while (l < r) {
|
||||
// 如果选择 p = l 必须先从右边找到小于 a[p] 的第一个元素
|
||||
while (l < r && a[r] >= a[p]) {
|
||||
r--;
|
||||
}
|
||||
swap(a, r, p);
|
||||
p = r;
|
||||
|
||||
// 从左边找到大于 a[p] 的第一个元素
|
||||
while (l < r && a[l] <= a[p]) {
|
||||
l++;
|
||||
}
|
||||
swap(a, l, p);
|
||||
p = l;
|
||||
System.out.println(Arrays.toString(a));
|
||||
|
||||
}
|
||||
|
||||
sort2(a, i, p - 1);
|
||||
sort2(a, p + 1, j);
|
||||
}
|
||||
}
|
||||
|
||||
123
budd-demo/src/main/java/io/github/ehlxr/File.java
Normal file
123
budd-demo/src/main/java/io/github/ehlxr/File.java
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2023 xrv <xrv@live.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package io.github.ehlxr;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.github.ehlxr.util.JsonUtils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ehlxr
|
||||
* @since 2023-03-15 16:08.
|
||||
*/
|
||||
public class File {
|
||||
public static void main(String[] args) {
|
||||
|
||||
String str0 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
String str2 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\"}";
|
||||
String str3 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\"}";
|
||||
String str4 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
String str5 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
String str6 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
String str7 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\"}";
|
||||
String str10 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"shortShareFriendPath\": \"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"addMaskGuide\":true,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":-1,\"addBubbleDuration\":5,\"barrageUiShow\": true,\"barrageSwitchOpen\": true}";
|
||||
String str17 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\"}";
|
||||
String str18 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\"}";
|
||||
String str19 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
String str21 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
String str22 = "{\"mode\":2,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
|
||||
// String str0 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":false,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":false,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":0,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":0,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
// String str2 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":false,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":false,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":0,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":0,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\"}";
|
||||
// String str3 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":false,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":false,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":0,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":0,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\"}";
|
||||
// String str4 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":false,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":0,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
// String str5 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":false,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":false,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":0,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
// String str6 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":false,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":false,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":0,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":0,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
// String str7 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":false,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":false,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":0,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":0,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\"}";
|
||||
// String str10 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":false,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"shortShareFriendPath\": \"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"addMaskGuide\":true,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":-1,\"addBubbleDuration\":5,\"barrageUiShow\": true,\"barrageSwitchOpen\": true}";
|
||||
// String str17 = "{\"mode\":0,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\"}";
|
||||
// String str18 = "{\"mode\":0,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\"}";
|
||||
// String str19 = "{\"mode\":0,\"isIOSAutoPlay\":true,\"isAndroidAutoPlay\":true,\"isShowDefaultPic\":true,\"isShowWeChatCircleShareButton\":true,\"isForceUpdate\":true,\"isGzhFullScreen\":true,\"isGzhAutoPlay\":true,\"isSharePageFullScreen\":true,\"isSharePageAutoPlay\":true,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":true,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":1,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":1,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoagreement.html\",\"serviceAgreementUrl\":\"https://rescdn.piaoquantv.com/agreement/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
// String str21 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":false,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":false,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":0,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":0,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
// String str22 = "{\"mode\":0,\"isIOSAutoPlay\":false,\"isAndroidAutoPlay\":false,\"isShowDefaultPic\":false,\"isShowWeChatCircleShareButton\":false,\"isForceUpdate\":true,\"isGzhFullScreen\":false,\"isGzhAutoPlay\":false,\"isSharePageFullScreen\":false,\"isSharePageAutoPlay\":false,\"distDir\":\"dist_1_3_4\",\"distNewDir\":\"dist_1_3_4\",\"videoShareFriendPath\":\"pages/user-videos\",\"videoShareMomentPath\":\"pages/user-videos\",\"userShareFriendPath\":\"pages/mine/mine-info\",\"userShareMomentPath\":\"pages/mine/mine-info\",\"addMaskGuide\":false,\"addMaskDayInterval\":2,\"addMaskMaxCount\":3,\"addMaskDuration\":10,\"addBubbleGuide\":true,\"addBubbleDayInterval\":2,\"addBubbleMaxCount\":3,\"addBubbleDuration\":10,\"shortShareFriendPath\":\"pages/shortvideo/shortvideo\",\"shortShareMomentPath\":\"pages/shortvideo/shortvideo\",\"barrageUiShow\":true,\"barrageSwitchOpen\":true,\"sortType\":2,\"barrageInputStates\":0,\"videoBarrageSwitch\":true,\"isOpenUnUploadReason\":false,\"isOpenUploadReason\":false,\"homeTabUserInfoPanel\":false,\"isShowDialogOnUpdate\":false,\"fundebug\":false,\"barrageSection\":30,\"isUploadPageLoadData\":0,\"showPayTipsMaxCount\":2,\"openFollowRemind\":true,\"dayFollowRemind\":1,\"totalFollowRemind\":3,\"sharePageRoute\":0,\"shouldFixWxRenderBug\":1,\"defaultSearchText\":\"搜索你想看的\",\"isShowDetailPageGuide\":false,\"gzhOtherVideoCount\":4,\"otherVideoCount\":10,\"shareVideoDialogCount\":2,\"videoShare2PageNotFoundPercent\":0,\"categoryRouterPercent\":100,\"fixed707Upload\":1,\"albumAvailable\":1,\"csVideoShareH5Title\":\"\",\"activityMoney\":2.88,\"privacyAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoagreement.html\",\"serviceAgreementUrl\":\"https://weapppiccdn.yishihui.com/resources/agreements/videoservice.html\",\"h5Domain\":\"https://vlogh5.piaoquantv.com/\",\"sendVideoIgnoreAuthorizeMobile\":1,\"sendVideoPostAuthorizeMobile\":1,\"noGrantLoginEnable\":1}";
|
||||
|
||||
Map<String, String> j0 = JsonUtils.string2Obj(str0, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j2 = JsonUtils.string2Obj(str2, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j3 = JsonUtils.string2Obj(str3, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j4 = JsonUtils.string2Obj(str4, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j5 = JsonUtils.string2Obj(str5, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j6 = JsonUtils.string2Obj(str6, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j7 = JsonUtils.string2Obj(str7, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j10 = JsonUtils.string2Obj(str10, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j17 = JsonUtils.string2Obj(str17, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j18 = JsonUtils.string2Obj(str18, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j19 = JsonUtils.string2Obj(str19, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j21 = JsonUtils.string2Obj(str21, new TypeReference<>() {
|
||||
});
|
||||
Map<String, String> j22 = JsonUtils.string2Obj(str22, new TypeReference<>() {
|
||||
});
|
||||
|
||||
|
||||
for (String key : j0.keySet()) {
|
||||
System.out.println(key + "|" + j0.get(key) + "|" + j2.remove(key)
|
||||
+ "|" + j3.remove(key)
|
||||
+ "|" + j4.remove(key)
|
||||
+ "|" + j5.remove(key)
|
||||
+ "|" + j6.remove(key)
|
||||
+ "|" + j7.remove(key)
|
||||
+ "|" + j10.remove(key)
|
||||
+ "|" + j17.remove(key)
|
||||
+ "|" + j18.remove(key)
|
||||
+ "|" + j19.remove(key)
|
||||
+ "|" + j21.remove(key)
|
||||
+ "|" + j22.remove(key));
|
||||
}
|
||||
|
||||
System.out.println("j2: " + j2);
|
||||
System.out.println("j3: " + j3);
|
||||
System.out.println("j4: " + j4);
|
||||
System.out.println("j5: " + j5);
|
||||
System.out.println("j6: " + j6);
|
||||
System.out.println("j7: " + j7);
|
||||
System.out.println("j10: " + j10);
|
||||
System.out.println("j17: " + j17);
|
||||
System.out.println("j18: " + j18);
|
||||
System.out.println("j19: " + j19);
|
||||
System.out.println("j21: " + j21);
|
||||
System.out.println("j22: " + j22);
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,11 @@
|
||||
|
||||
package io.github.ehlxr;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author ehlxr
|
||||
* @since 2022-01-17 06:31.
|
||||
@@ -31,12 +36,15 @@ package io.github.ehlxr;
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
int[][] ns = {
|
||||
{ 1, 2, 3, 4 },
|
||||
{ 5, 6, 7, 8 },
|
||||
{ 9, 10, 11, 12 }
|
||||
{1, 2, 3, 4},
|
||||
{5, 6, 7, 8},
|
||||
{9, 10, 11, 12}
|
||||
};
|
||||
System.out.println(ns.length); // 3
|
||||
System.out.println(ns[0].length); // 4
|
||||
System.out.println(ns[2][2]); // 11
|
||||
|
||||
|
||||
List<String> collect = Stream.of("111", "wwwdddd", "dddddd", "12").filter(x -> x.length() > 3).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,11 @@
|
||||
<groupId>io.github.ehlxr</groupId>
|
||||
<artifactId>budd-demo</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
38
budd-utils/pom.xml
Normal file
38
budd-utils/pom.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>io.github.ehlxr</groupId>
|
||||
<artifactId>budd</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>budd-utils</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
424
budd-utils/src/main/java/io/github/ehlxr/utils/Try.java
Normal file
424
budd-utils/src/main/java/io/github/ehlxr/utils/Try.java
Normal file
@@ -0,0 +1,424 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2020 xrv <xrv@live.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package io.github.ehlxr.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* 异常处理,简化 try catch
|
||||
*
|
||||
* @author ehlxr
|
||||
* @since 2020-12-03 10:37.
|
||||
*/
|
||||
public interface Try {
|
||||
/**
|
||||
* 构建消费型(有入参,无返回)Tryable 对象
|
||||
*
|
||||
* @param consumer {@link ThrowableConsumer} 类型函数式接口
|
||||
* @param <P> 入参类型
|
||||
* @return {@link TryConsumer}
|
||||
*/
|
||||
static <P> TryConsumer<P> of(ThrowableConsumer<? super P> consumer) {
|
||||
return new TryConsumer<>(consumer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建供给型(无入参,有返回)Tryable 对象
|
||||
*
|
||||
* @param supplier {@link ThrowableSupplier} 类型函数式接口
|
||||
* @param <R> 返回值类型
|
||||
* @return {@link TrySupplier}
|
||||
*/
|
||||
static <R> TrySupplier<R> of(ThrowableSupplier<? extends R> supplier) {
|
||||
return new TrySupplier<>(supplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建功能型(有入参,有返回)Tryable 对象
|
||||
*
|
||||
* @param function {@link ThrowableFunction} 类型函数式接口
|
||||
* @param <P> 入参类型
|
||||
* @param <R> 返回值类型
|
||||
* @return {@link TryFunction}
|
||||
*/
|
||||
static <P, R> TryFunction<P, R> of(ThrowableFunction<? super P, ? extends R> function) {
|
||||
return new TryFunction<>(function);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建运行型(无入参,无返回)Tryable 对象
|
||||
*
|
||||
* @param runnable {@link ThrowableRunnable} 类型函数式接口
|
||||
* @return {@link TryRunnable}
|
||||
*/
|
||||
static TryRunnable of(ThrowableRunnable runnable) {
|
||||
return new TryRunnable(runnable);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"ConstantConditions", "Convert2MethodRef"})
|
||||
static void main(String[] args) {
|
||||
System.out.println("------------有返回值,无入参----------------");
|
||||
// 有返回值,无入参
|
||||
String param = "hello";
|
||||
Long result = Try.of(() -> Long.valueOf(param)).get(0L);
|
||||
System.out.println("Long.valueOf 1: " + result);
|
||||
|
||||
result = Try.of(() -> Long.valueOf(param)).get();
|
||||
System.out.println("Long.valueOf 2: " + result);
|
||||
|
||||
System.out.println("------------有返回值,有入参----------------");
|
||||
// 有返回值,有入参
|
||||
result = Try.<Map<String, String>, Long>of(s -> Long.valueOf(s.get("k1")))
|
||||
// .apply(ImmutableMap.of("k1", param))
|
||||
.trap(e -> System.out.println("Long.valueOf exception: " + e.getMessage()))
|
||||
.andFinally(() -> System.out.println("This message will ignore."))
|
||||
.andFinally(s -> {
|
||||
// Map<String, Object> returnMap = JsonUtils.string2Obj(JsonUtils.obj2String(s), new TypeReference<Map<String, Object>>() {
|
||||
// });
|
||||
// System.out.println("Long.valueOf finally run code." + s);
|
||||
// // 演示抛异常
|
||||
// String k2 = returnMap.get("k2").toString();
|
||||
// System.out.println(k2);
|
||||
})
|
||||
.finallyTrap(e -> System.out.println("Long.valueOf finally exception: " + e.getMessage()))
|
||||
.get();
|
||||
System.out.println("Long.valueOf 3: " + result);
|
||||
|
||||
ArrayList<String> list = null;
|
||||
|
||||
System.out.println("-----------无返回值,无入参-----------------");
|
||||
// 无返回值,无入参
|
||||
Try.of(() -> Thread.sleep(-1L))
|
||||
.andFinally(() -> list.clear())
|
||||
// .andFinally(list::clear) //https://stackoverflow.com/questions/37413106/java-lang-nullpointerexception-is-thrown-using-a-method-reference-but-not-a-lamb
|
||||
.run();
|
||||
|
||||
System.out.println("--------------无返回值,有入参--------------");
|
||||
// 无返回值,有入参
|
||||
Try.<String>of(v -> list.add(0, v))
|
||||
.andFinally(s -> System.out.println(s))
|
||||
.accept("hello");
|
||||
}
|
||||
|
||||
class TryRunnable extends Tryable<TryRunnable> {
|
||||
private final ThrowableRunnable runnable;
|
||||
|
||||
protected TryRunnable(ThrowableRunnable runnable) {
|
||||
Objects.requireNonNull(runnable, "No runnable present");
|
||||
this.runnable = runnable;
|
||||
|
||||
super.c = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算结果
|
||||
*/
|
||||
public void run() {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (final Throwable e) {
|
||||
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||
} finally {
|
||||
doFinally();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TrySupplier<R> extends Tryable<TrySupplier<R>> {
|
||||
private final ThrowableSupplier<? extends R> supplier;
|
||||
|
||||
protected TrySupplier(ThrowableSupplier<? extends R> supplier) {
|
||||
Objects.requireNonNull(supplier, "No supplier present");
|
||||
this.supplier = supplier;
|
||||
|
||||
super.c = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果有异常返回默认值,否则返回计算结果
|
||||
*
|
||||
* @param r 指定默认值
|
||||
* @return 实际值或默认值
|
||||
*/
|
||||
public R get(R r) {
|
||||
try {
|
||||
return supplier.get();
|
||||
} catch (final Throwable e) {
|
||||
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||
return r;
|
||||
} finally {
|
||||
doFinally();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果有异常返回 null,否则返回计算结果
|
||||
*
|
||||
* @return 实际值或 null
|
||||
*/
|
||||
public R get() {
|
||||
try {
|
||||
return supplier.get();
|
||||
} catch (final Throwable e) {
|
||||
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||
return null;
|
||||
} finally {
|
||||
doFinally();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface ThrowableConsumer<P> {
|
||||
/**
|
||||
* Performs this operation on the given argument.
|
||||
*
|
||||
* @param p the input argument
|
||||
* @throws Throwable throwable
|
||||
*/
|
||||
void accept(P p) throws Throwable;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface ThrowableSupplier<R> {
|
||||
/**
|
||||
* Gets a result.
|
||||
*
|
||||
* @return a result
|
||||
* @throws Throwable throwable
|
||||
*/
|
||||
R get() throws Throwable;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface ThrowableRunnable {
|
||||
/**
|
||||
* Performs this operation
|
||||
*
|
||||
* @throws Throwable throwable
|
||||
*/
|
||||
void run() throws Throwable;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface ThrowableFunction<P, R> {
|
||||
/**
|
||||
* Applies this function to the given argument.
|
||||
*
|
||||
* @param p the function argument
|
||||
* @return the function result
|
||||
* @throws Throwable throwable
|
||||
*/
|
||||
R apply(P p) throws Throwable;
|
||||
}
|
||||
|
||||
abstract class Tryable<C> {
|
||||
Consumer<? super Throwable> throwConsumer;
|
||||
ThrowableRunnable finallyRunnable;
|
||||
ThrowableConsumer<? super Object> finallyConsumer;
|
||||
Consumer<? super Throwable> finallyThrowConsumer;
|
||||
C c;
|
||||
|
||||
/**
|
||||
* 处理 finally
|
||||
*/
|
||||
protected void doFinally() {
|
||||
Optional.ofNullable(finallyRunnable).ifPresent(r -> {
|
||||
try {
|
||||
r.run();
|
||||
} catch (final Throwable e) {
|
||||
Optional.ofNullable(finallyThrowConsumer).ifPresent(tc -> tc.accept(e));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理带参数类型 finally
|
||||
*
|
||||
* @param p 入参
|
||||
* @param <P> 入参类型
|
||||
*/
|
||||
protected <P> void doFinally(P p) {
|
||||
if (Objects.nonNull(finallyConsumer)) {
|
||||
try {
|
||||
finallyConsumer.accept(p);
|
||||
} catch (final Throwable e) {
|
||||
Optional.ofNullable(finallyThrowConsumer).ifPresent(tc -> tc.accept(e));
|
||||
}
|
||||
} else {
|
||||
doFinally();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果有异常,调用自定义异常处理表达式
|
||||
*
|
||||
* @param throwableConsumer 自定义异常处理 lambda 表达式
|
||||
* @return {@link C}
|
||||
*/
|
||||
public C trap(Consumer<? super Throwable> throwableConsumer) {
|
||||
Objects.requireNonNull(throwableConsumer, "No throwableConsumer present");
|
||||
this.throwConsumer = throwableConsumer;
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义 finally 处理表达式
|
||||
* <p>
|
||||
* 注意:如果类型为 {@link TryConsumer}、{@link TryFunction} 并且已经调用 {@link #andFinally(ThrowableConsumer)} 则忽略
|
||||
*
|
||||
* @param finallyRunnable finally 处理 lambda 表达式
|
||||
* @return {@link C}
|
||||
*/
|
||||
public C andFinally(ThrowableRunnable finallyRunnable) {
|
||||
Objects.requireNonNull(finallyRunnable, "No finallyRunnable present");
|
||||
this.finallyRunnable = finallyRunnable;
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义 finally 处理表达式
|
||||
* <p>
|
||||
* 注意:只会对 {@link TryConsumer}、{@link TryFunction} 类型对象起作用
|
||||
*
|
||||
* @param finallyConsumer finally 处理 lambda 表达式
|
||||
* @return {@link C}
|
||||
*/
|
||||
public C andFinally(ThrowableConsumer<? super Object> finallyConsumer) {
|
||||
Objects.requireNonNull(finallyConsumer, "No finallyConsumer present");
|
||||
this.finallyConsumer = finallyConsumer;
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果 finally 有异常,调用自定义异常处理表达式
|
||||
*
|
||||
* @param finallyThrowableConsumer 自定义异常处理 lambda 表达式
|
||||
* @return {@link C}
|
||||
*/
|
||||
public C finallyTrap(Consumer<? super Throwable> finallyThrowableConsumer) {
|
||||
Objects.requireNonNull(finallyThrowableConsumer, "No finallyThrowableConsumer present");
|
||||
this.finallyThrowConsumer = finallyThrowableConsumer;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
class TryConsumer<P> extends Tryable<TryConsumer<P>> {
|
||||
private final ThrowableConsumer<? super P> consumer;
|
||||
|
||||
protected TryConsumer(ThrowableConsumer<? super P> consumer) {
|
||||
Objects.requireNonNull(consumer, "No consumer present");
|
||||
this.consumer = consumer;
|
||||
|
||||
super.c = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算结果
|
||||
*
|
||||
* @param p 要计算的入参
|
||||
*/
|
||||
public void accept(P p) {
|
||||
try {
|
||||
Objects.requireNonNull(p, "No accept param present");
|
||||
|
||||
consumer.accept(p);
|
||||
} catch (final Throwable e) {
|
||||
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||
} finally {
|
||||
// doFinally();
|
||||
doFinally(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TryFunction<P, R> extends Tryable<TryFunction<P, R>> {
|
||||
private final ThrowableFunction<? super P, ? extends R> function;
|
||||
private P p;
|
||||
|
||||
protected TryFunction(ThrowableFunction<? super P, ? extends R> function) {
|
||||
Objects.requireNonNull(function, "No function present");
|
||||
this.function = function;
|
||||
|
||||
super.c = this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 传入要计算的入参
|
||||
*
|
||||
* @param p 要计算的入参
|
||||
* @return {@link TryFunction}
|
||||
*/
|
||||
public TryFunction<P, R> apply(P p) {
|
||||
Objects.requireNonNull(p, "Apply param should not null");
|
||||
|
||||
this.p = p;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果有异常返回默认值,否则返回计算结果
|
||||
*
|
||||
* @param r 指定默认值
|
||||
* @return 实际值或默认值
|
||||
*/
|
||||
public R get(R r) {
|
||||
try {
|
||||
Objects.requireNonNull(function, "No apply param present");
|
||||
|
||||
return function.apply(p);
|
||||
} catch (final Throwable e) {
|
||||
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||
return r;
|
||||
} finally {
|
||||
// doFinally();
|
||||
doFinally(p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果有异常返回 null,否则返回计算结果
|
||||
*
|
||||
* @return 实际值或 null
|
||||
*/
|
||||
public R get() {
|
||||
try {
|
||||
Objects.requireNonNull(p, "No apply param present");
|
||||
|
||||
return function.apply(p);
|
||||
} catch (final Throwable e) {
|
||||
Optional.ofNullable(throwConsumer).ifPresent(tc -> tc.accept(e));
|
||||
return null;
|
||||
} finally {
|
||||
// doFinally();
|
||||
doFinally(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
66
jetbrains.svg
Normal file
66
jetbrains.svg
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="120.1px" height="130.2px" viewBox="0 0 120.1 130.2" style="enable-background:new 0 0 120.1 130.2;" xml:space="preserve"
|
||||
>
|
||||
<g>
|
||||
<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.8412" y1="120.5578" x2="110.2402" y2="73.24">
|
||||
<stop offset="0" style="stop-color:#FCEE39"/>
|
||||
<stop offset="1" style="stop-color:#F37B3D"/>
|
||||
</linearGradient>
|
||||
<path id="XMLID_3041_" style="fill:url(#XMLID_2_);" d="M118.6,71.8c0.9-0.8,1.4-1.9,1.5-3.2c0.1-2.6-1.8-4.7-4.4-4.9
|
||||
c-1.2-0.1-2.4,0.4-3.3,1.1l0,0l-83.8,45.9c-1.9,0.8-3.6,2.2-4.7,4.1c-2.9,4.8-1.3,11,3.6,13.9c3.4,2,7.5,1.8,10.7-0.2l0,0l0,0
|
||||
c0.2-0.2,0.5-0.3,0.7-0.5l78-54.8C117.3,72.9,118.4,72.1,118.6,71.8L118.6,71.8L118.6,71.8z"/>
|
||||
<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="48.3607" y1="6.9083" x2="119.9179" y2="69.5546">
|
||||
<stop offset="0" style="stop-color:#EF5A6B"/>
|
||||
<stop offset="0.57" style="stop-color:#F26F4E"/>
|
||||
<stop offset="1" style="stop-color:#F37B3D"/>
|
||||
</linearGradient>
|
||||
<path id="XMLID_3049_" style="fill:url(#XMLID_3_);" d="M118.8,65.1L118.8,65.1L55,2.5C53.6,1,51.6,0,49.3,0
|
||||
c-4.3,0-7.7,3.5-7.7,7.7v0c0,2.1,0.8,3.9,2.1,5.3l0,0l0,0c0.4,0.4,0.8,0.7,1.2,1l67.4,57.7l0,0c0.8,0.7,1.8,1.2,3,1.3
|
||||
c2.6,0.1,4.7-1.8,4.9-4.4C120.2,67.3,119.7,66,118.8,65.1z"/>
|
||||
<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="52.9467" y1="63.6407" x2="10.5379" y2="37.1562">
|
||||
<stop offset="0" style="stop-color:#7C59A4"/>
|
||||
<stop offset="0.3852" style="stop-color:#AF4C92"/>
|
||||
<stop offset="0.7654" style="stop-color:#DC4183"/>
|
||||
<stop offset="0.957" style="stop-color:#ED3D7D"/>
|
||||
</linearGradient>
|
||||
<path id="XMLID_3042_" style="fill:url(#XMLID_4_);" d="M57.1,59.5C57,59.5,17.7,28.5,16.9,28l0,0l0,0c-0.6-0.3-1.2-0.6-1.8-0.9
|
||||
c-5.8-2.2-12.2,0.8-14.4,6.6c-1.9,5.1,0.2,10.7,4.6,13.4l0,0l0,0C6,47.5,6.6,47.8,7.3,48c0.4,0.2,45.4,18.8,45.4,18.8l0,0
|
||||
c1.8,0.8,3.9,0.3,5.1-1.2C59.3,63.7,59,61,57.1,59.5z"/>
|
||||
<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="52.1736" y1="3.7019" x2="10.7706" y2="37.8971">
|
||||
<stop offset="0" style="stop-color:#EF5A6B"/>
|
||||
<stop offset="0.364" style="stop-color:#EE4E72"/>
|
||||
<stop offset="1" style="stop-color:#ED3D7D"/>
|
||||
</linearGradient>
|
||||
<path id="XMLID_3057_" style="fill:url(#XMLID_5_);" d="M49.3,0c-1.7,0-3.3,0.6-4.6,1.5L4.9,28.3c-0.1,0.1-0.2,0.1-0.2,0.2l-0.1,0
|
||||
l0,0c-1.7,1.2-3.1,3-3.9,5.1C-1.5,39.4,1.5,45.9,7.3,48c3.6,1.4,7.5,0.7,10.4-1.4l0,0l0,0c0.7-0.5,1.3-1,1.8-1.6l34.6-31.2l0,0
|
||||
c1.8-1.4,3-3.6,3-6.1v0C57.1,3.5,53.6,0,49.3,0z"/>
|
||||
<g id="XMLID_3008_">
|
||||
<rect id="XMLID_3033_" x="34.6" y="37.4" style="fill:#000000;" width="51" height="51"/>
|
||||
<rect id="XMLID_3032_" x="39" y="78.8" style="fill:#FFFFFF;" width="19.1" height="3.2"/>
|
||||
<g id="XMLID_3009_">
|
||||
<path id="XMLID_3030_" style="fill:#FFFFFF;" d="M38.8,50.8l1.5-1.4c0.4,0.5,0.8,0.8,1.3,0.8c0.6,0,0.9-0.4,0.9-1.2l0-5.3l2.3,0
|
||||
l0,5.3c0,1-0.3,1.8-0.8,2.3c-0.5,0.5-1.3,0.8-2.3,0.8C40.2,52.2,39.4,51.6,38.8,50.8z"/>
|
||||
<path id="XMLID_3028_" style="fill:#FFFFFF;" d="M45.3,43.8l6.7,0v1.9l-4.4,0V47l4,0l0,1.8l-4,0l0,1.3l4.5,0l0,2l-6.7,0
|
||||
L45.3,43.8z"/>
|
||||
<path id="XMLID_3026_" style="fill:#FFFFFF;" d="M55,45.8l-2.5,0l0-2l7.3,0l0,2l-2.5,0l0,6.3l-2.3,0L55,45.8z"/>
|
||||
<path id="XMLID_3022_" style="fill:#FFFFFF;" d="M39,54l4.3,0c1,0,1.8,0.3,2.3,0.7c0.3,0.3,0.5,0.8,0.5,1.4v0
|
||||
c0,1-0.5,1.5-1.3,1.9c1,0.3,1.6,0.9,1.6,2v0c0,1.4-1.2,2.3-3.1,2.3l-4.3,0L39,54z M43.8,56.6c0-0.5-0.4-0.7-1-0.7l-1.5,0l0,1.5
|
||||
l1.4,0C43.4,57.3,43.8,57.1,43.8,56.6L43.8,56.6z M43,59l-1.8,0l0,1.5H43c0.7,0,1.1-0.3,1.1-0.8v0C44.1,59.2,43.7,59,43,59z"/>
|
||||
<path id="XMLID_3019_" style="fill:#FFFFFF;" d="M46.8,54l3.9,0c1.3,0,2.1,0.3,2.7,0.9c0.5,0.5,0.7,1.1,0.7,1.9v0
|
||||
c0,1.3-0.7,2.1-1.7,2.6l2,2.9l-2.6,0l-1.7-2.5h-1l0,2.5l-2.3,0L46.8,54z M50.6,58c0.8,0,1.2-0.4,1.2-1v0c0-0.7-0.5-1-1.2-1
|
||||
l-1.5,0v2H50.6z"/>
|
||||
<path id="XMLID_3016_" style="fill:#FFFFFF;" d="M56.8,54l2.2,0l3.5,8.4l-2.5,0l-0.6-1.5l-3.2,0l-0.6,1.5l-2.4,0L56.8,54z
|
||||
M58.8,59l-0.9-2.3L57,59L58.8,59z"/>
|
||||
<path id="XMLID_3014_" style="fill:#FFFFFF;" d="M62.8,54l2.3,0l0,8.3l-2.3,0L62.8,54z"/>
|
||||
<path id="XMLID_3012_" style="fill:#FFFFFF;" d="M65.7,54l2.1,0l3.4,4.4l0-4.4l2.3,0l0,8.3l-2,0L68,57.8l0,4.6l-2.3,0L65.7,54z"
|
||||
/>
|
||||
<path id="XMLID_3010_" style="fill:#FFFFFF;" d="M73.7,61.1l1.3-1.5c0.8,0.7,1.7,1,2.7,1c0.6,0,1-0.2,1-0.6v0
|
||||
c0-0.4-0.3-0.5-1.4-0.8c-1.8-0.4-3.1-0.9-3.1-2.6v0c0-1.5,1.2-2.7,3.2-2.7c1.4,0,2.5,0.4,3.4,1.1l-1.2,1.6
|
||||
c-0.8-0.5-1.6-0.8-2.3-0.8c-0.6,0-0.8,0.2-0.8,0.5v0c0,0.4,0.3,0.5,1.4,0.8c1.9,0.4,3.1,1,3.1,2.6v0c0,1.7-1.3,2.7-3.4,2.7
|
||||
C76.1,62.5,74.7,62,73.7,61.1z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.8 KiB |
8
pom.xml
8
pom.xml
@@ -6,6 +6,7 @@
|
||||
<module>budd-common</module>
|
||||
<module>budd-demo</module>
|
||||
<module>budd-server</module>
|
||||
<module>budd-utils</module>
|
||||
</modules>
|
||||
|
||||
<groupId>io.github.ehlxr</groupId>
|
||||
@@ -59,6 +60,13 @@
|
||||
<artifactId>budd-demo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>2.0.25</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user