This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.a_pz.sample.java8sample; | |
import java.io.File; | |
import java.io.IOException; | |
import java.nio.charset.StandardCharsets; | |
import java.nio.file.Files; | |
import java.util.Arrays; | |
import java.util.concurrent.ConcurrentMap; | |
import java.util.stream.Collectors; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
@Log4j2 | |
public String index() throws MessagingException { | |
MailForm form = new MailForm("[email protected]", "[email protected]", "タイトル", "ここに本文が入ります"); | |
String result = generateMailText(form); | |
log.info("mailtext {}" , () -> result.toString()); | |
return result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.List; | |
import lombok.Builder; | |
import lombok.ToString; | |
@Builder | |
@ToString | |
public class Userinfo { | |
private String username; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrElseThrowSnipet { | |
void sample() { | |
List<String> list = new ArrayList<>(); | |
list.stream().findFirst().orElseThrow( | |
() -> { | |
log.warn("error."); | |
throw new RuntimeException("elseThrowで例外を発生しました"); | |
} | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
package lumi.sample.result; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package seren.sample.s2_convention.actions; | |
import com.opensymphony.xwork2.ActionSupport; | |
import org.apache.struts2.convention.annotation.Action; | |
import org.apache.struts2.convention.annotation.Namespace; | |
import org.apache.struts2.convention.annotation.Result; | |
import org.apache.struts2.convention.annotation.Results; | |
@Namespace("/") | |
@Results(@Result(name = ActionSupport.SUCCESS, location = "test.jsp")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package serendip.spring.sample.mybatis.repository | |
import org.mybatis.spring.boot.test.autoconfigure.MybatisTest | |
import org.springframework.beans.factory.annotation.Autowired | |
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase | |
import org.springframework.context.annotation.Import | |
import serendip.spring.sample.mybatis.MybatisSpringApplication | |
import serendip.spring.sample.mybatis.model.MemberModel | |
import spock.lang.Specification |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IntStreamSample { | |
private int parseLength = 3; | |
public List<String> parse(String target) { | |
if (target == null || target.isEmpty()) { | |
return Collections.emptyList(); | |
} | |
final String parseTarget = " " + target + " "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StreamMapperTest { | |
@Test | |
public void test() { | |
List<String> addresses = Arrays.asList("test","app","go@com"); | |
addresses.stream().map(v -> getDomain(v)).forEach(System.out::println); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.AllArgsConstructor; | |
import lombok.Getter; | |
/** | |
* カピバラ区分。 | |
*/ | |
@Getter @AllArgsConstructor | |
public enum CapybaraDivision { | |
BATH("01", "お風呂"), SPA("02", "温泉"); |