Skip to content

Instantly share code, notes, and snippets.

View Human.java
package jp.co.confrage.template;
public abstract class Human {
protected String sayMessage;
protected String byeMessage;
public Human(String sayMessage, String byeMessage) {
this.sayMessage = sayMessage;
this.byeMessage = byeMessage;
}
View Human.java
package jp.co.confrage;
public class Human {
private String names;
private Integer ages;
private String hobbies;
private Human(String names, Integer ages, String hobbies) { // 不可視コンストラクタ
this.names = names;
View Sample.java
package jp.co.confrage;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Sample {
public static void main(String[] args) {
List<Integer> a = Arrays.asList(10, 100);
View cloudwatch.json
{
"searchedLogStreams": [
{
"searchedCompletely": "全てのログを検索したかどうか", // true or false
"logStreamName": "ログストリーム名"
}
// ...オブジェクトが続く
],
"events": [
{
View Week.java
package jp.co.confrage;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum Week {
Sunday("日"),
Monday("月"),
View EnumSample.java
package jp.co.confrage;
import java.util.Arrays;
import java.util.stream.Collectors;
public class EnumSample {
public static void main(String[] args) {
var ret =
Arrays.stream(Week.values())
.map(
View OptionalSample.java
package jp.co.confrage;
import java.util.Optional;
public class OptionalSample {
public static void main(String[] args) {
Integer max = null;
Optional<Integer> nullableMax = Optional.ofNullable(max);
nullableMax.orElseThrow(RuntimeException::new); // 例外スローする
}
View Optional.java
package jp.co.confrage;
import java.util.Objects;
import java.util.Optional;
public class OptionalSample {
public static void main(String[] args) {
Integer max = Integer.valueOf(1);
if (Objects.isNull(max)) {
max = Integer.valueOf(2);
View build.gradle
plugins {
id 'java-library'
}
sourceCompatibility = 11
targetCompatibility = 11
repositories {
jcenter()
}
View gist:84cb9ccf55d63c09146999e481cf789c
RootProject # ルートプロジェクト
├─build.gradle
├─settings.gradle
└─SubProject # サブプロジェクト
└─build.gradle