Skip to content

Instantly share code, notes, and snippets.

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

断臂残猿 davelet

🎯
开启一段新旅程
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

package com.yonghui.css.clearing.center.util;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.dispatch.*;
import akka.event.Logging;
import akka.event.LoggingAdapter;
import com.typesafe.config.Config;
import scala.Option;
@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)
@davelet
davelet / LocalDateTimeUtil.java
Created August 21, 2019 01:39
java 8 日期api 与老Date类型互转
package your.util;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.Date;
@davelet
davelet / MessageDelayLevelEnum.java
Last active August 21, 2019 01:36
rocketMQ 消息发送延迟级别枚举
package your.packaje;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
/**
* <pre>
* <b>消息延迟级别</b>
* </pre>
*