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
| { | |
| "username": "jsmith", | |
| "_links": { | |
| "self": { | |
| "href": "http://localhost:8080/users/1" | |
| }, | |
| "user": { | |
| "href": "http://localhost:8080/users/1{?projection}", | |
| "templated": true | |
| }, |
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
| @RepositoryRestController | |
| public class UserController { | |
| private final UserRepository userRepository; | |
| private final RepositoryEntityLinks links; | |
| public UserController(final UserRepository userRepository, | |
| final RepositoryEntityLinks links) { | |
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
| { | |
| "firstName": "John", | |
| "links": [ | |
| { | |
| "rel": "self", | |
| "href": "http://localhost:8080/users/1?fields=firstName" | |
| }, | |
| { | |
| "rel": "user", | |
| "href": "http://localhost:8080/users/1{?projection}" |
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
| @RestController | |
| public class UserController { | |
| private final UserRepository userRepository; | |
| public UserController(final UserRepository userRepository) { | |
| this.userRepository = userRepository; | |
| } | |
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
| { | |
| "username": "jsmith" | |
| } |
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
| { | |
| "username": "jsmith", | |
| "firstName": "John" | |
| } |
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
| @Component | |
| public class RestConfig extends RepositoryRestConfigurerAdapter { | |
| @Override | |
| public void configureJacksonObjectMapper(final ObjectMapper objectMapper) { | |
| objectMapper.setFilterProvider(new SimpleFilterProvider().setFailOnUnknownId(false)); | |
| } | |
| } |
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
| @RepositoryRestController | |
| public class UserController { | |
| private final UserRepository userRepository; | |
| public UserController(final UserRepository userRepository) { | |
| this.userRepository = userRepository; | |
| } | |
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 RepeatedWordFinder { | |
| public static void main(String[] args) { | |
| System.out.println(findTheMostRepeatedWord("House, House, House, Dog, Dog, Dog, Dog, cat,cat")); | |
| } | |
| public static String findTheMostRepeatedWord(String s) { | |
| return Arrays.stream(s.toLowerCase().trim().split("[\\n\\t\\r.,;:!?()]")) |
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
| class FileTimeChecker{ | |
| public static void main(String[] args) throws IOException, URISyntaxException { | |
| Path path = Files.write(Paths.get("/hey.txt"), "hey".getBytes()); | |
| File file = new File("/hey.txt"); | |
| Instant fileInstant = Instant.ofEpochMilli(file.lastModified()); | |
| System.out.println("fileInstant: " + fileInstant); |