Skip to content

Instantly share code, notes, and snippets.

View saka1029's full-sized avatar

saka1029 saka1029

View GitHub Profile
package test.puzzle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.jupiter.api.Test;
package test.puzzle.lambda;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import org.junit.jupiter.api.Test;
@saka1029
saka1029 / TestIterableAsStream.java
Created September 28, 2020 04:44
拡張しやすいStream APIの代替を作ってみる
package test.qiita.newObject;
import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@saka1029
saka1029 / TestTokyoMetro.java
Created July 15, 2020 14:31
駅データ.jpのCSVファイルから東京の地下鉄路線図を作る
package test.puzzle.station;
import static java.util.stream.Collectors.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
@saka1029
saka1029 / TestMemoize3.java
Last active December 7, 2016 09:11
関数をメモ化する関数。カリー化すると引数が2個以上ある関数も処理できる。最後のテストはキャッシュを外部に取り出す例。
package stackoverflow;
import static org.junit.Assert.*;
import java.math.BigInteger;
import static java.math.BigInteger.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
public class Main {
@saka1029
saka1029 / Type.java
Last active August 29, 2015 14:22
Creating a new object based on enum type and reflection
public enum Type {
A(ClassA.class),
B(ClassB.class),
C(ClassC.class),
D(ClassD.class),
E(ClassE.class);
private final Class<?> clazz;
@saka1029
saka1029 / Dependency.java
Last active February 12, 2016 23:05
Dependency Algorithm - find a minimum set of packages to install
package stackoverflow.dependency;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;