Skip to content

Instantly share code, notes, and snippets.

View davelet's full-sized avatar
🎯
开启一段新旅程

断臂残猿 davelet

🎯
开启一段新旅程
  • 上海
  • 05:32 (UTC +08:00)
View GitHub Profile
@davelet
davelet / java_rust_generic.md
Created March 20, 2024 06:02 — forked from Kimundi/java_rust_generic.md
A light comparison between Rust and Java generics and type system features.

Introduction

If you are familiar with Java's generics, and are coming to Rust, you might be lead to assume that its generics are working the same way.

However, due to the different type systems, and different implementation details, there are quite a few differences between generic code in both languages.

This document tries to give a short summary about those differences:

Core functionality

Java

@davelet
davelet / akka-streams-101
Created October 23, 2019 07:44
akka streams 简单入门
private static ActorSystem actorSystem = ActorSystem.create("testActor");
private List<Integer> parseLine(String line) {
String[] fields = line.split(";");
return Arrays.stream(fields)
.map(Integer::parseInt)
.collect(Collectors.toList());
}
private Flow<String, Integer, NotUsed> parseContent() {
return Flow.of(String.class)