JJUG CCC 2012 Fall, R1-1 いまさら Coin, されど Coin のスライドです。
This Presentation 狠狠撸 is the session about PJ Coin at JJUG Cross Community Conference 2012 Fall(Tokyo/Japan), 2012/11/10, The Bellesalle Mita
JJUG CCC 2012 Fall, R1-1 いまさら Coin, されど Coin のスライドです。
This Presentation 狠狠撸 is the session about PJ Coin at JJUG Cross Community Conference 2012 Fall(Tokyo/Japan), 2012/11/10, The Bellesalle Mita
This document discusses WebSocket technology and some example applications. It introduces WebSocket as a web technology that provides bidirectional communication between a client and server. It then describes projects that use WebSocket with Spring Boot, for real-time web applications, and WebRTC to share video streams between browsers using HTML5 APIs and canvas elements. Finally, it mentions deploying WebSocket applications to Heroku and the possibility of using Raspberry Pi devices with Node.js, Python, or Java for embedded applications that communicate over WebSocket.
This document provides an overview of Lombok, a Java library that automatically plugs into editors and builds to provide automatic generation of boilerplate code like getters, setters, equals, hashCode and toString methods. It summarizes the main Lombok annotations like @Getter, @Setter, @ToString, @EqualsAndHashCode, @Builder and how they generate standard Java code. It also covers other annotations like @Value, @Data, @Slf4j, @NonNull, @Cleanup and how they simplify code. In the end it provides links to learn more about Lombok features and the delombok tool.
Spring Boot is a framework for building Java applications. It is built on top of Spring and includes features such as embedded Tomcat, Jetty, or Undertow servers and automatic configuration to simplify development. Spring Initializr can be used to set up Spring Boot projects with common dependencies using Maven or Gradle. It allows generating a basic "Hello World" application quickly. Spring Boot applications can also use Spring Data JPA to easily interact with databases and auto-configuration to simplify app configuration.
Protect Your IoT Data with UbiBot's Private Platform.pptxユビボット 株式会社
?
Our on-premise IoT platform offers a secure and scalable solution for businesses, with features such as real-time monitoring, customizable alerts and open API support, and can be deployed on your own servers to ensure complete data privacy and control.
5. レコード (Java16)
? classの代わりにrecordで定義し、名前の後にフィールドのリストを
記載
? 下記の標準クラスと同等になる
public final class Rectangle {
private final int length;
private final int width;
public Rectangle(int length, int width) {
this.length = length;
this.width = width;
}
public int length() { return this.length; }
public int width() { return this.width; }
public boolean equals(Object obj) {...} // 省略(各フィールドを使った適切な処理)
public int hashCode() {...} // 省略(各フィールドを使った適切な処理)
public String toString() {...} // 省略(各フィールドを使った適切な処理)
}
public record Rectangle(int length, int width) { }
7. レコード (Java16)
? 独自メソッドも宣言できる
? コンストラクタにチェック処理を追加したり、独自コンストラクタ
を追加できる
public record Rectangle(int length, int width) {
public Rectangle {
if (length < 0 || width < 0) {
throw new IllegalArgumentException();
}
}
public Rectangle(int length) {
this(length, 0);
}
}
public record Rectangle(int length, int width) {
public int area() {
return length * width;
}
}
10. テキストブロック (Java15)
? 複数行にまたがる文字列を宣言できるようになった
? メジャーなプログラミング言語で書けなかったのはJavaくらいでは
? Programmer's Guide to Text Blocks - Oracle Help Center
https://docs.oracle.com/javase/jp/15/text-blocks/index.html
参考
24. String#transform (Java12)
? String を引数に取るメソッドを実行して結果を返すメソッドとして、
transform メソッドが追加
? メソッド呼び出し1回だと、あまりメリットを感じないが、メソッ
ド呼び出しが続くような場合には、処理が左から右に流れるように
書けるので、読みやすくなる
int num = "1".transform(Integer::parseInt);
// これと同じ
int num = Integer.parseInt("1");
int num = "12#34".transform(this::clean).transform(Integer::valueOf);
26. 蝉飞颈迟肠丑式 (Java14)
? switchを式としても書けるようになった
? 式なのでswitchが値を返すように
? 式 - Java言語更新 - Oracle Help Center
https://docs.oracle.com/javase/jp/13/language/switch-expressions.html
参考
27. 蝉飞颈迟肠丑式 (Java14)
? switch文で条件に応じて値を設定するようなものが、蝉飞颈迟肠丑式に置
き換えられる
// switch文
int numLetters;
switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
numLetters = 6;
break;
case TUESDAY:
numLetters = 7;
break;
case THURSDAY:
case SATURDAY:
numLetters = 8;
break;
case WEDNESDAY:
numLetters = 9;
break;
default:
throw new IllegalStateException();
}
// 蝉飞颈迟肠丑式
int numLetters = switch (day) {
case MONDAY, FRIDAY, SUNDAY -> 6;
case TUESDAY -> 7;
case THURSDAY, SATURDAY -> 8;
case WEDNESDAY -> 9;
default -> throw new IllegalStateException();
};
28. 蝉飞颈迟肠丑式 (Java14)
? 新たに追加されたアローcaseラベル(アロー構文)か、今まで通りの
コロンcaseラベル+yieldで値を返す
// アローcaseラベル
int numLetters = switch (day) {
case MONDAY, FRIDAY, SUNDAY -> 6;
case TUESDAY -> 7;
case THURSDAY, SATURDAY -> 8;
case WEDNESDAY -> 9;
default -> throw new IllegalStateException();
};
// コロンcaseラベル+yield
int numLetters = switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
yield 6;
case TUESDAY:
yield 7;
case THURSDAY:
case SATURDAY:
yield 8;
case WEDNESDAY:
yield 9;
default:
throw new IllegalStateException();
};
29. 蝉飞颈迟肠丑式 (Java14)
? アローcaseラベルでも、複数の式が必要な場合は、ブロック+yield
を使う
int numLetters = switch (day) {
case MONDAY, FRIDAY, SUNDAY -> {
System.out.println(6);
yield 6;
}
case TUESDAY -> {
System.out.println(7);
yield 7;
}
case THURSDAY, SATURDAY -> {
System.out.println(8);
yield 8;
}
case WEDNESDAY -> {
System.out.println(9);
yield 9;
}
default -> throw new IllegalStateException();
};
30. 蝉飞颈迟肠丑式 (Java14)
? コロンcaseラベルでも、ラベルをカンマ区切りで複数書けるように
なった
? 既存のswitch文でも書ける
switch (day) {
case MONDAY, FRIDAY, SUNDAY:
System.out.println(6);
break;
case TUESDAY:
System.out.println(7);
break;
case THURSDAY, SATURDAY:
System.out.println(8);
break;
case WEDNESDAY:
System.out.println(9);
break;
default:
throw new IllegalStateException();
}