文档添加关于字符串、字节和void数据类型的说明

在NumPy文档中,常规介绍部分现在包含了关于字符串、字节和void数据类型的信息,以及现有的数值类型。
This commit is contained in:
kyriewhluo 2024-09-03 19:58:40 +08:00
parent 8b2871b87e
commit 6720c74fc3
3 changed files with 93 additions and 4 deletions

View File

@ -2,15 +2,49 @@ package cn.whaifree.leetCode.Array;
import org.junit.Test;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Random;
import java.io.*;
import java.util.*;
import java.util.function.BiConsumer;
import static org.junit.Assert.assertArrayEquals;
public class LeetCode215 {
public static void main(String[] args) throws FileNotFoundException {
String name = "/Users/kyriewhluo/IdeaProjects/tsf/tsf-dispatch/src/main/resources/tsf-dispatch.yml";
// 读取每一行
HashMap<String, List<String>> map = new HashMap<>();
try (BufferedReader reader = new BufferedReader(new FileReader(name))) {
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("tsf-resource")) {
String[] split = line.split("/");
String key = "/" + split[1] + "/" + split[2];
List<String> orDefault = map.getOrDefault(key, new ArrayList<>());
orDefault.add(line);
map.put(key, orDefault);
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
map.forEach(new BiConsumer<String, List<String>>() {
@Override
public void accept(String s, List<String> strings) {
System.out.println("# key:" + s);
System.out.println("# size:" + strings.size());
for (String string : strings) {
System.out.println(string);
}
for (int i = 0; i < 3; i++) {
System.out.println();
}
}
});
}
@Test
public void sort_EmptyArray_ShouldHandleGracefull3y() {

View File

@ -0,0 +1,55 @@
package cn.whaifree.tech.dataStructure;
import org.junit.Test;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
public class listSeries {
@Test
public void test() throws IOException, ClassNotFoundException {
ReentrantLock reentrantLock = new ReentrantLock();
}
public static void main(String[] args) throws IOException, ClassNotFoundException {
List<User> o = new ArrayList<>();
o.add(new User(1, "110"));
try(FileOutputStream fileOutputStream = new FileOutputStream("./user.ser")) {
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
objectOutputStream.writeObject(o);
}
// 恢复对象
try(FileInputStream fileInputStream = new FileInputStream("./user.ser")) {
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
Object o1 = objectInputStream.readObject();
List<User> users = (List<User>) o1;
System.out.println(users);
}
}
static class User implements Serializable{
int age;
String name;
public User(int age, String name) {
this.age = age;
this.name = name;
}
@Override
public String toString() {
return "User{" +
"age=" + age +
", name='" + name + '\'' +
'}';
}
}
}

BIN
user.ser Normal file

Binary file not shown.