Skip to content

Instantly share code, notes, and snippets.

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
View build.gradle
plugins {
id 'org.springframework.boot' version '2.2.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'war'
}
repositories {
jcenter()
}
View DateTest.java
package jp.co.confrage;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.chrono.IsoChronology;
import java.time.format.DateTimeFormatter;
import java.time.format.ResolverStyle;
public class DateTest {
You can’t perform that action at this time.