brew install deno (太慢,而且不是最新版本)curl -fsSL https://x.deno.js.cn/install.sh | sh (镜像安装)curl -fsSL https://x.deno.js.cn/install.sh | sh -s v1.1.0 (镜像安装 + 指定版本)sudo docker run -p 3306:3306 --name wp_mysql -v /root/data/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=199529 -d mysql:8.0
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '199529';
FLUSH PRIVILEGES;
public static void main(String[] args) {
String originFileUrl = "";
String savePath = "";
String fileName = "";
InputStream is = null;
FileOutputStream fos = null;
try {
URL url = new URL(originFileUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty(USER_AGENT, USER_AGENT_VALUE);
is = conn.getInputStream();
//文件保存位置
File saveDir = new File(savePath);
if (!saveDir.exists()) {
boolean mkdir = saveDir.mkdir();
logger.info("mkdir : {}, result: {}", savePath, mkdir);
}
File file = new File(saveDir + File.separator + fileName);
fos = new FileOutputStream(file);
fos.getChannel().transferFrom(Channels.newChannel(is), 0, Integer.MAX_VALUE);
fos.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(fos);
IOUtils.closeQuietly(is);
}
}
public static void main(String[] args) {
List<String> list = Arrays.asList(new String[]{});
list.add("1");
list.add("2");
}
Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
at com.yeting.tarot.service.UserService.main(UserService.java:193)
原因
Arrays.asList内部ArrayList是内部单独继承实现的,没有实现add方法,跟java.util.ArrayList不是一回事,如图:

In computing, reactive programming is a declarative programming paradigm concerned
with data streams and the propagation of change.
public static void declarative() {
int[] iArr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
Arrays.stream(iArr).forEach(System.out::println);
}
public static void imperative() {
int[] iArr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
for (int i = 0; i < iArr.length; i++) {
System.out.println(iArr[i]);
}
}
In plain terms reactive programming is about non-blocking applications that are asynchronous
and event-driven and require a small number of threads to scale vertically (i.e. within the JVM)
rather than horizontally (i.e. through clustering).
A key aspect of reactive applications is the concept of backpressure which is a mechanism to
ensure producers don’t overwhelm consumers. For example in a pipeline of reactive components
extending from the database to the HTTP response when the HTTP connection is too slow the data
repository can also slow down or stop completely until network capacity frees up.
Reactive programming also leads to a major shift from imperative to declarative async composition
of logic. It is comparable to writing blocking code vs using the CompletableFuture from Java 8 to
compose follow-up actions via lambda expressions.
mac: dtruss(dtruss -p [PID])