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
@Test | |
public void convert_shouldReturnIV() { | |
final String romanNumeral = RomanNumerals.convert(4); | |
assertThat(romanNumeral, is("IV")); | |
} |
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
private static final NavigableMap<Integer, String> ROMAN_NUMERALS = new TreeMap<>() { | |
{ | |
put(1, "I"); | |
put(4, "IV"); | |
put(5, "V"); | |
put(9, "IX"); | |
put(10, "X"); | |
put(50, "L"); | |
put(100, "C"); | |
put(500, "D"); |
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
@Test | |
public void convert_shouldReturnVI() { | |
final String romanNumeral = RomanNumerals.convert(6); | |
assertThat(romanNumeral, is("VI")); | |
} |
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
@Test | |
public void convert_shouldReturnDCCCXXXVIII() { | |
final String romanNumeral = RomanNumerals.convert(838); | |
assertThat(romanNumeral, is("DCCCXXXVIII")); | |
} |
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 org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.time.LocalTime; | |
import java.util.Collection; | |
import java.util.List; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.Executor; | |
import java.util.concurrent.TimeUnit; |
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 MyClass { | |
private MyAppState myAppState; | |
synchronized public void pleaseBlockMe() { | |
// omitted code | |
updateState(); | |
// omitted code | |
} | |
private void updateState() { |
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
Runnable task = () -> System.out.println("EXECUTED!"); | |
CompletableFuture.runAsync(task); |
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
Runnable task = () -> { | |
System.out.println("Async task thread : " + Thread.currentThread().getName()); | |
System.out.println("EXECUTED!"); | |
}; | |
final CompletableFuture<Void> future = CompletableFuture.runAsync(task); | |
System.out.println("Main thread : " + Thread.currentThread().getName()); | |
future.join(); |