情人湖觀景台
1 2 3 | OptionalTest.Project(id=1, name=FMS) OptionalTest.Project(id=1, name=NSS) OptionalTest.Project(id=1, name=DBM) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | @Slf4j public class OptionalTest { public static void main(String[] args) { OptionalTest test = new OptionalTest(); Project test1 = test.getProjectByName("test"); log.debug("test1 = " + test1.toString()); } private Project getProjectByName(String name) { return getProjects().stream().filter(p -> p.getName().equals(name)).findAny().orElse(null); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | @Slf4j public class OptionalTest { public static void main(String[] args) { OptionalTest test = new OptionalTest(); Project test1 = test.getProjectByName("test"); if (test1 != null) { log.debug("test1 = " + test1.toString()); } else { throw new RuntimeException("無資料"); } } private Project getProjectByName(String name) { return getProjects().stream().filter(p -> p.getName().equals(name)).findAny().orElse(null); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | @Slf4j public class OptionalTest { public static void main(String[] args) { OptionalTest test = new OptionalTest(); Project test2 = test.getProjectByNameWithOptional("test").get(); log.debug("test2 = " + test2.toString()); } private Project getProjectByName(String name) { return getProjects().stream().filter(p -> p.getName().equals(name)).findAny().orElse(null); } private Optional<Project> getProjectByNameWithOptional(String name) { Optional<Project> project = Optional.ofNullable(getProjects().stream() .filter(p -> p.getName().equals(name)).findAny().orElse(null)); return project; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | @Slf4j public class OptionalTest { public static void main(String[] args) { OptionalTest test = new OptionalTest(); Project test2 = test.getProjectByNameWithOptional("test").get(); log.debug("test2 = " + test2.toString()); } private Project getProjectByName(String name) { return getProjects().stream().filter(p -> p.getName().equals(name)).findAny().orElse(null); } private Optional<Project> getProjectByNameWithOptional(String name) { Optional<Project> project = Optional.ofNullable(getProjects().stream() .filter(p -> p.getName().equals(name)).findAny().orElse(null)); project.orElseThrow(() -> new RuntimeException("查無資料")); return project; } } |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Hello Page</title> <script src="helloWorld.js"></script> </head> <body> <form id='myForm'> <img src="magnifier.png" height="20" width="20"> <input type="text" id="queryString" style="width:100px"> <button type="submit" id="doSearch">Search</button> </form> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <!DOCTYPE html> <html style="min-width:210px;"> <head> <meta charset="UTF-8"> <title>Hello Page</title> <script src="helloWorld.js"></script> </head> <body> <form id='myForm'> <img src="magnifier.png" height="20" width="20"> <input type="text" id="queryString" style="width:100px"> <button type="submit" id="doSearch">Search</button> </form> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 | {
"manifest_version": 2,
"name": "Hello World",
"description": "My first Chrome extension",
"version": "1.0",
"permissions": [ "activeTab" ],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "helloworld.html"
}
}
|

1 2 3 4 5 6 7 8 9 10 11 | <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Hello Page</title> </head> <body> Hello! It is my first Chrome extension!!!! </body> </html> |

alert("Hello World! 測試測試");
1 2 3 4 5 6 7 8 9 10 11 12 | <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Hello Page</title> <script src="helloWorld.js"></script> </head> <body> Hello! It is my first Chrome extension!!!! </body> </html> |

1 2 3 4 5 6 7 8 9 10 11 12 13 | package albert.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class HelloController { @RequestMapping("/") public String sayHello(){ return "Hello! Spring Boot!"; } } |

1 2 3 4 | <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> </dependency> |
1 2 3 4 | spring:
devtools:
restart:
enabled: true
|






1 2 3 4 5 6 7 8 9 10 11 12 13 14 | package com.example.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class HelloController { @RequestMapping("/") public String sayHello(){ return "Hello! Spring Boot!"; } } |






