This file contains 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 mypackage; | |
import mypackage.Identifiable; | |
import java.util.Objects; | |
import java.util.Set; | |
public final class EntitySetUtil { | |
private EntitySetUtil() { | |
// not meant to be initialized |
This file contains 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 AxonIntegrationTest extends AbstractIntegrationTest { | |
@Test | |
void create_document_in_google_docs__propagate_to_ms_word_online(@Autowired EventBus eventBus){ | |
AxonTestUtil.executeAndWaitForEvents( | |
() -> documentService.createGoogleDocument(...), | |
eventBus, 2, DocumentSavedEvent.class | |
); | |
//instead of this: | |
//documentService.createGoogleDocument(...); |
This file contains 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 org.junit.jupiter.api.Test; | |
import java.time.Duration; | |
import java.time.LocalDateTime; | |
import java.time.LocalTime; | |
import java.time.temporal.ChronoUnit; | |
import java.util.Comparator; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; |
This file contains 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); |
This file contains 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 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 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 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 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 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; | |
} | |
NewerOlder