diff --git a/S00_BoringMain.java b/S0000_BoringMain.java similarity index 76% rename from S00_BoringMain.java rename to S0000_BoringMain.java index ccaefc2..9a884ca 100644 --- a/S00_BoringMain.java +++ b/S0000_BoringMain.java @@ -1,4 +1,4 @@ -public class S00_BoringMain { +public class S0000_BoringMain { public static void main(String[] args) { System.out.println("boring and complex"); diff --git a/S01_Executable.java b/S0001_Executable.java similarity index 71% rename from S01_Executable.java rename to S0001_Executable.java index 6eb5c51..f5c9e91 100644 --- a/S01_Executable.java +++ b/S0001_Executable.java @@ -1,4 +1,4 @@ -public interface S01_Executable { +public interface S0001_Executable { static void main(String... args) { System.out.println("hello,duke"); diff --git a/S02_MainInterface.java b/S0002_MainInterface.java similarity index 73% rename from S02_MainInterface.java rename to S0002_MainInterface.java index c4cfe74..3fcd2b3 100644 --- a/S02_MainInterface.java +++ b/S0002_MainInterface.java @@ -1,4 +1,4 @@ -interface S02_MainInterface { +interface S0002_MainInterface { static void main(String... args) { System.out.println("hello,duke"); diff --git a/S0003_VarArgs.java b/S0003_VarArgs.java new file mode 100644 index 0000000..b855500 --- /dev/null +++ b/S0003_VarArgs.java @@ -0,0 +1,14 @@ +interface S0003_VarArgs { + + static void hello(String... messages) { + for (var message : messages) { + System.out.println(message); + } + } + + static void main(String... args) { + S0003_VarArgs.hello("hey", "duke", "java"); + S0003_VarArgs.hello("is", "working"); + S0003_VarArgs.hello(new String[] { "is", "always", "working" }); + } +} \ No newline at end of file diff --git a/S04_Timer.java b/S0004_Timer.java similarity index 92% rename from S04_Timer.java rename to S0004_Timer.java index bbab80d..500cb51 100644 --- a/S04_Timer.java +++ b/S0004_Timer.java @@ -1,7 +1,7 @@ import java.util.Timer; import java.util.TimerTask; -public class S04_Timer { +public class S0004_Timer { public static void main(String[] args) { var task = new TimerTask() { diff --git a/S05_ScheduledThreadPool.java b/S0005_ScheduledThreadPool.java similarity index 60% rename from S05_ScheduledThreadPool.java rename to S0005_ScheduledThreadPool.java index 0a248ae..2183409 100644 --- a/S05_ScheduledThreadPool.java +++ b/S0005_ScheduledThreadPool.java @@ -1,11 +1,11 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -interface S05_ScheduledThreadPool { +interface S0005_ScheduledThreadPool { static void main(String... args) { var scheduler = Executors.newScheduledThreadPool(1); scheduler - .scheduleAtFixedRate(()-> System.out.println("hello"), 0, 1, TimeUnit.SECONDS); + .scheduleAtFixedRate(() -> System.out.println("hello"), 0, 1, TimeUnit.SECONDS); } } \ No newline at end of file diff --git a/S06_FileWatch.java b/S0006_FileWatch.java similarity index 95% rename from S06_FileWatch.java rename to S0006_FileWatch.java index 14a84f0..4ce8044 100644 --- a/S06_FileWatch.java +++ b/S0006_FileWatch.java @@ -3,7 +3,7 @@ import java.nio.file.StandardWatchEventKinds; import java.nio.file.WatchEvent; -interface S06_FileWatch { +interface S0006_FileWatch { static void main(String... args) throws Exception { diff --git a/S07_FileDiff.java b/S0007_FileDiff.java similarity index 66% rename from S07_FileDiff.java rename to S0007_FileDiff.java index c6c231b..47f3b1b 100644 --- a/S07_FileDiff.java +++ b/S0007_FileDiff.java @@ -2,11 +2,11 @@ import java.nio.file.Files; import java.nio.file.Path; -interface S07_FileDiff { +interface S0007_FileDiff { static void main(String... args) throws IOException { - var first = Path.of("a.txt"); - var second = Path.of("b.txt"); + var first = Path.of("S0000_BoringMain.java"); + var second = Path.of("S0001_Executable.java"); var firstDifferentByte = Files.mismatch(first, second); System.out.println(firstDifferentByte); diff --git a/S08_CopyToClipboard.java b/S0008_CopyToClipboard.java similarity index 96% rename from S08_CopyToClipboard.java rename to S0008_CopyToClipboard.java index 9e58826..154b871 100644 --- a/S08_CopyToClipboard.java +++ b/S0008_CopyToClipboard.java @@ -4,7 +4,7 @@ import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; -public class S08_CopyToClipboard { +public class S0008_CopyToClipboard { public static void main(String[] args) { var message = "from java " + System.nanoTime(); diff --git a/S09_ReadFromClipboard.java b/S0009_ReadFromClipboard.java similarity index 91% rename from S09_ReadFromClipboard.java rename to S0009_ReadFromClipboard.java index 238f8b3..e8a122e 100644 --- a/S09_ReadFromClipboard.java +++ b/S0009_ReadFromClipboard.java @@ -3,7 +3,7 @@ import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; -public class S09_ReadFromClipboard { +public class S0009_ReadFromClipboard { public static void main(String[] args) throws UnsupportedFlavorException, IOException { var cb = Toolkit.getDefaultToolkit().getSystemClipboard(); diff --git a/S10_ReadFromConsole.java b/S0010_ReadFromConsole.java similarity index 84% rename from S10_ReadFromConsole.java rename to S0010_ReadFromConsole.java index e527880..8226d4a 100644 --- a/S10_ReadFromConsole.java +++ b/S0010_ReadFromConsole.java @@ -1,4 +1,4 @@ -public class S10_ReadFromConsole { +public class S0010_ReadFromConsole { public static void main(String[] args) { var console = System.console(); diff --git a/S11_ReadPassword.java b/S0011_ReadPassword.java similarity index 84% rename from S11_ReadPassword.java rename to S0011_ReadPassword.java index b854161..20c9d20 100644 --- a/S11_ReadPassword.java +++ b/S0011_ReadPassword.java @@ -1,4 +1,4 @@ -public class S11_ReadPassword { +public class S0011_ReadPassword { public static void main(String[] args) { var console = System.console(); diff --git a/S12_CustomJVM.java b/S0012_CustomJVM.java similarity index 84% rename from S12_CustomJVM.java rename to S0012_CustomJVM.java index 92ab6a6..7c1d8cc 100644 --- a/S12_CustomJVM.java +++ b/S0012_CustomJVM.java @@ -1,4 +1,4 @@ -public interface S12_CustomJVM { +public interface S0012_CustomJVM { /** * javac diff --git a/S13_Emoji.java b/S0013_Emoji.java similarity index 80% rename from S13_Emoji.java rename to S0013_Emoji.java index 6283292..cb119f4 100644 --- a/S13_Emoji.java +++ b/S0013_Emoji.java @@ -1,4 +1,5 @@ -public class S13_Emoji { +public class S0013_Emoji { + static final String ROCKET = "🚀"; public static void main(String[] args) { diff --git a/S14_SystemOutInColor.java b/S0014_SystemOutInColor.java similarity index 88% rename from S14_SystemOutInColor.java rename to S0014_SystemOutInColor.java index a9bb3ce..d627963 100644 --- a/S14_SystemOutInColor.java +++ b/S0014_SystemOutInColor.java @@ -2,7 +2,7 @@ /** * https://en.wikipedia.org/wiki/ANSI_escape_code */ -interface S14_SystemOutInColor { +interface S0014_SystemOutInColor { static void main(String... args) { System.out.println("\033[0;31mhello, duke"); diff --git a/S15_BuiltInLogger.java b/S0015_BuiltInLogger.java similarity index 86% rename from S15_BuiltInLogger.java rename to S0015_BuiltInLogger.java index 4fabffd..98208ee 100644 --- a/S15_BuiltInLogger.java +++ b/S0015_BuiltInLogger.java @@ -1,6 +1,6 @@ import java.lang.System.Logger.Level; -public class S15_BuiltInLogger { +public class S0015_BuiltInLogger { public static void main(String[] args) { var log = System.getLogger("duke"); log.log(Level.INFO, "hello, world"); diff --git a/S16_AutoCloseable.java b/S0016_AutoCloseable.java similarity index 57% rename from S16_AutoCloseable.java rename to S0016_AutoCloseable.java index 3a67e9f..4a85b49 100644 --- a/S16_AutoCloseable.java +++ b/S0016_AutoCloseable.java @@ -1,11 +1,11 @@ -public class S16_AutoCloseable implements AutoCloseable { +public class S0016_AutoCloseable implements AutoCloseable { @Override public void close() { System.out.println("closing"); } public static void main(String[] args) { - try (var a = new S16_AutoCloseable()) { + try (var a = new S0016_AutoCloseable()) { } } diff --git a/S17_StaticInitializer.java b/S0017_StaticInitializer.java similarity index 86% rename from S17_StaticInitializer.java rename to S0017_StaticInitializer.java index c49104b..3544a70 100644 --- a/S17_StaticInitializer.java +++ b/S0017_StaticInitializer.java @@ -1,4 +1,4 @@ -class S17_StaticInitializer{ +class S0017_StaticInitializer{ static{ System.out.println("s1"); } diff --git a/S0018_InitializersAndConstructors.java b/S0018_InitializersAndConstructors.java new file mode 100644 index 0000000..0d30386 --- /dev/null +++ b/S0018_InitializersAndConstructors.java @@ -0,0 +1,20 @@ +public class S0018_InitializersAndConstructors { + + public S0018_InitializersAndConstructors() { + System.out.println("parameterless"); + } + + public S0018_InitializersAndConstructors(String name) { + System.out.println(name); + } + + { + System.out.println("shared code"); + } + + + public static void main(String[] args) { + new S0018_InitializersAndConstructors(); + new S0018_InitializersAndConstructors("with parameter"); + } +} \ No newline at end of file diff --git a/S20_Assert.java b/S0020_Assert.java similarity index 87% rename from S20_Assert.java rename to S0020_Assert.java index 85431f2..009f57c 100644 --- a/S20_Assert.java +++ b/S0020_Assert.java @@ -1,7 +1,7 @@ import java.util.Objects; //-ea -public class S20_Assert { +public class S0020_Assert { static void parameterNeeded(String input) { assert input != null; diff --git a/S21_TerminalReset.java b/S0021_TerminalReset.java similarity index 83% rename from S21_TerminalReset.java rename to S0021_TerminalReset.java index 4ca30b8..80109a3 100644 --- a/S21_TerminalReset.java +++ b/S0021_TerminalReset.java @@ -1,6 +1,6 @@ import java.io.IOException; -interface S21_TerminalReset { +interface S0021_TerminalReset { static void main(String... args) throws IOException { System.out.println("duke is not nice"); diff --git a/S22_CompactNumberFormat.java b/S0022_CompactNumberFormat.java similarity index 85% rename from S22_CompactNumberFormat.java rename to S0022_CompactNumberFormat.java index 21c48b8..4872fce 100644 --- a/S22_CompactNumberFormat.java +++ b/S0022_CompactNumberFormat.java @@ -1,6 +1,6 @@ import java.text.NumberFormat; -public class S22_CompactNumberFormat { +public class S0022_CompactNumberFormat { public static void main(String[] args) { var number = 10000; diff --git a/S23_UnderscoresInNumbers.java b/S0023_UnderscoresInNumbers.java similarity index 81% rename from S23_UnderscoresInNumbers.java rename to S0023_UnderscoresInNumbers.java index 0826e0b..54074a8 100644 --- a/S23_UnderscoresInNumbers.java +++ b/S0023_UnderscoresInNumbers.java @@ -1,4 +1,4 @@ -public class S23_UnderscoresInNumbers { +public class S0023_UnderscoresInNumbers { public static void main(String[] args) { var number = 10_000_000; diff --git a/S24_FunctionalInterface.java b/S0024_FunctionalInterface.java similarity index 51% rename from S24_FunctionalInterface.java rename to S0024_FunctionalInterface.java index 165c6c2..c203698 100644 --- a/S24_FunctionalInterface.java +++ b/S0024_FunctionalInterface.java @@ -1,5 +1,5 @@ @FunctionalInterface -interface S24_FunctionalInterface { +interface S0024_FunctionalInterface { void first(); } \ No newline at end of file diff --git a/S25_Sam.java b/S0025_Sam.java similarity index 84% rename from S25_Sam.java rename to S0025_Sam.java index ff9c635..5ca3611 100644 --- a/S25_Sam.java +++ b/S0025_Sam.java @@ -1,4 +1,4 @@ -public class S25_Sam { +public class S0025_Sam { public static void main(String[] args) { Runnable r = () -> System.out.println("working"); new Thread(r).start(); diff --git a/S26_AttributeDefaultOptional.java b/S0026_AttributeDefaultOptional.java similarity index 93% rename from S26_AttributeDefaultOptional.java rename to S0026_AttributeDefaultOptional.java index 1f1f16c..eb8fcc4 100644 --- a/S26_AttributeDefaultOptional.java +++ b/S0026_AttributeDefaultOptional.java @@ -1,6 +1,6 @@ import static java.util.Optional.ofNullable; -interface S26_AttributeDefaultOptional { +interface S0026_AttributeDefaultOptional { class Developer { private String name; diff --git a/S27_ObjectsPreconditions.java b/S0027_ObjectsPreconditions.java similarity index 71% rename from S27_ObjectsPreconditions.java rename to S0027_ObjectsPreconditions.java index 093fca6..413c4cc 100644 --- a/S27_ObjectsPreconditions.java +++ b/S0027_ObjectsPreconditions.java @@ -1,14 +1,14 @@ import java.time.LocalDateTime; import java.util.Objects; -public class S27_ObjectsPreconditions { +public class S0027_ObjectsPreconditions { static String error() { return "input please now: " + LocalDateTime.now(); } static void parameterPlease(String input) { - Objects.requireNonNull(input, S27_ObjectsPreconditions::error); + Objects.requireNonNull(input, S0027_ObjectsPreconditions::error); } public static void main(String[] args) { diff --git a/S28_Formatted.java b/S0028_Formatted.java similarity index 85% rename from S28_Formatted.java rename to S0028_Formatted.java index f84a9b8..d8c12ff 100644 --- a/S28_Formatted.java +++ b/S0028_Formatted.java @@ -1,4 +1,4 @@ -public class S28_Formatted { +public class S0028_Formatted { public static void main(String[] args) { var message = """ diff --git a/S29_PositionInFormatted.java b/S0029_PositionInFormatted.java similarity index 86% rename from S29_PositionInFormatted.java rename to S0029_PositionInFormatted.java index b7fcd7d..72f45ea 100644 --- a/S29_PositionInFormatted.java +++ b/S0029_PositionInFormatted.java @@ -1,4 +1,4 @@ -public class S29_PositionInFormatted { +public class S0029_PositionInFormatted { public static void main(String[] args) { var message = """ diff --git a/S30_CreateTempFolder.java b/S0030_CreateTempFolder.java similarity index 85% rename from S30_CreateTempFolder.java rename to S0030_CreateTempFolder.java index 79b91f2..95e59fd 100644 --- a/S30_CreateTempFolder.java +++ b/S0030_CreateTempFolder.java @@ -1,7 +1,7 @@ import java.io.IOException; import java.nio.file.Files; -public class S30_CreateTempFolder { +public class S0030_CreateTempFolder { public static void main(String[] args) throws IOException { var temp = Files.createTempDirectory("airhacks"); diff --git a/S31_CreateDirectories.java b/S0031_CreateDirectories.java similarity index 86% rename from S31_CreateDirectories.java rename to S0031_CreateDirectories.java index 66f811d..608012c 100644 --- a/S31_CreateDirectories.java +++ b/S0031_CreateDirectories.java @@ -2,7 +2,7 @@ import java.nio.file.Files; import java.nio.file.Path; -public class S31_CreateDirectories { +public class S0031_CreateDirectories { public static void main(String[] args) throws IOException { var path = Path.of("hello/duke/rocks"); diff --git a/S32_DirectoryStream.java b/S0032_DirectoryStream.java similarity index 92% rename from S32_DirectoryStream.java rename to S0032_DirectoryStream.java index a9f45b1..9c517c7 100644 --- a/S32_DirectoryStream.java +++ b/S0032_DirectoryStream.java @@ -2,7 +2,7 @@ import java.nio.file.Files; import java.nio.file.Path; -public class S32_DirectoryStream { +public class S0032_DirectoryStream { static void createDirectories() throws IOException { for (int i = 0; i < 10; i++) { diff --git a/S33_Capitalize.java b/S0033_Capitalize.java similarity index 88% rename from S33_Capitalize.java rename to S0033_Capitalize.java index 4d9d0d8..e042a41 100644 --- a/S33_Capitalize.java +++ b/S0033_Capitalize.java @@ -1,4 +1,4 @@ -interface S33_Capitalize { +interface S0033_Capitalize { static String cap(String name) { var first = Character.toUpperCase(name.charAt(0)); var rem = name.substring(1); diff --git a/S34_CloudNativeSystemEnv.java b/S0034_CloudNativeSystemEnv.java similarity index 77% rename from S34_CloudNativeSystemEnv.java rename to S0034_CloudNativeSystemEnv.java index ec0cb46..05a80f0 100644 --- a/S34_CloudNativeSystemEnv.java +++ b/S0034_CloudNativeSystemEnv.java @@ -1,4 +1,4 @@ -public class S34_CloudNativeSystemEnv { +public class S0034_CloudNativeSystemEnv { public static void main(String[] args) { var home = System.getenv().get("JAVA_HOME"); diff --git a/S35_LinesString.java b/S0035_LinesString.java similarity index 91% rename from S35_LinesString.java rename to S0035_LinesString.java index 15eefce..9bca132 100644 --- a/S35_LinesString.java +++ b/S0035_LinesString.java @@ -1,4 +1,4 @@ -public class S35_LinesString { +public class S0035_LinesString { public static void main(String[] args) { var result = """ diff --git a/S37_FileCopy.java b/S0037_FileCopy.java similarity index 88% rename from S37_FileCopy.java rename to S0037_FileCopy.java index 85c06bf..a1fd9e1 100644 --- a/S37_FileCopy.java +++ b/S0037_FileCopy.java @@ -2,7 +2,7 @@ import static java.nio.file.Path.*; import java.io.IOException; -interface S37_FileCopy { +interface S0037_FileCopy { static void main(String... args) throws IOException { Files.copy(of("App.java"), of("App.next")); } diff --git a/S38_StreamArraytoStream.java b/S0038_StreamArraytoStream.java similarity index 87% rename from S38_StreamArraytoStream.java rename to S0038_StreamArraytoStream.java index 59a07d9..7040e64 100644 --- a/S38_StreamArraytoStream.java +++ b/S0038_StreamArraytoStream.java @@ -1,7 +1,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -public class S38_StreamArraytoStream { +public class S0038_StreamArraytoStream { public static void main(String[] args) { var stringArgs = Stream diff --git a/S39_EndlessStreams.java b/S0039_EndlessStreams.java similarity index 90% rename from S39_EndlessStreams.java rename to S0039_EndlessStreams.java index 7e52f7d..8629b0f 100644 --- a/S39_EndlessStreams.java +++ b/S0039_EndlessStreams.java @@ -1,7 +1,7 @@ import java.time.LocalDateTime; import java.util.stream.Stream; -interface S39_EndlessStreams { +interface S0039_EndlessStreams { static void main(String... args) { var dates = Stream diff --git a/S40_SoutRedirect.java b/S0040_SoutRedirect.java similarity index 89% rename from S40_SoutRedirect.java rename to S0040_SoutRedirect.java index f4e14b1..345ab75 100644 --- a/S40_SoutRedirect.java +++ b/S0040_SoutRedirect.java @@ -4,7 +4,7 @@ /** * App */ -public class S40_SoutRedirect { +public class S0040_SoutRedirect { public static void main(String[] args) throws FileNotFoundException { var s = new PrintStream("log.file"); diff --git a/S41_TimeVsChronoUnit.java b/S0041_TimeVsChronoUnit.java similarity index 88% rename from S41_TimeVsChronoUnit.java rename to S0041_TimeVsChronoUnit.java index c027005..94efc00 100644 --- a/S41_TimeVsChronoUnit.java +++ b/S0041_TimeVsChronoUnit.java @@ -1,7 +1,7 @@ import java.time.temporal.ChronoUnit; import java.util.concurrent.TimeUnit; -interface S41_TimeVsChronoUnit { +interface S0041_TimeVsChronoUnit { static void main(String... args) throws InterruptedException { System.out.println("what's the difference?"); diff --git a/S42_IntegerCaching.java b/S0042_IntegerCaching.java similarity index 90% rename from S42_IntegerCaching.java rename to S0042_IntegerCaching.java index 0b8e6ff..3654205 100644 --- a/S42_IntegerCaching.java +++ b/S0042_IntegerCaching.java @@ -1,4 +1,4 @@ -interface S42_IntegerCaching { +interface S0042_IntegerCaching { static void main(String... args) { var number = 128; diff --git a/S43_JWTDecoder.java b/S0043_JWTDecoder.java similarity index 94% rename from S43_JWTDecoder.java rename to S0043_JWTDecoder.java index 5f36a78..048310d 100644 --- a/S43_JWTDecoder.java +++ b/S0043_JWTDecoder.java @@ -2,7 +2,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -interface S43_JWTDecoder { +interface S0043_JWTDecoder { static void main(String... args) { var parts = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" diff --git a/S44_Ternary.java b/S0044_Ternary.java similarity index 85% rename from S44_Ternary.java rename to S0044_Ternary.java index 5533eab..a1d54b9 100644 --- a/S44_Ternary.java +++ b/S0044_Ternary.java @@ -1,4 +1,4 @@ -interface S44_Ternary { +interface S0044_Ternary { static void main(String... args) { var input = ""; diff --git a/S45_Peek.java b/S0045_Peek.java similarity index 91% rename from S45_Peek.java rename to S0045_Peek.java index e5c6df5..8fce4d1 100644 --- a/S45_Peek.java +++ b/S0045_Peek.java @@ -1,6 +1,6 @@ import java.util.List; -public class S45_Peek { +public class S0045_Peek { public static void main(String[] args) { var result = List.of("a", "b", "c") .stream() diff --git a/S50_CrazyQuestion.java b/S0050_CrazyQuestion.java similarity index 85% rename from S50_CrazyQuestion.java rename to S0050_CrazyQuestion.java index f1b87d8..260f61d 100644 --- a/S50_CrazyQuestion.java +++ b/S0050_CrazyQuestion.java @@ -1,4 +1,4 @@ -interface S50_CrazyQuestion { +interface S0050_CrazyQuestion { static void main(String... args) { diff --git a/S51_Frequency.java b/S0051_Frequency.java similarity index 88% rename from S51_Frequency.java rename to S0051_Frequency.java index 9c56991..aca6ff9 100644 --- a/S51_Frequency.java +++ b/S0051_Frequency.java @@ -1,7 +1,7 @@ import java.util.Collections; import java.util.List; -interface S51_Frequency { +interface S0051_Frequency { static void main(String... args) { var numbers = List.of(1,2,2,2,3,3,3); diff --git a/S52_RecordInAClass.java b/S0052_RecordInAClass.java similarity index 92% rename from S52_RecordInAClass.java rename to S0052_RecordInAClass.java index b2c644a..26b004f 100644 --- a/S52_RecordInAClass.java +++ b/S0052_RecordInAClass.java @@ -1,6 +1,6 @@ import java.util.stream.Stream; -public class S52_RecordInAClass { +public class S0052_RecordInAClass { public static void main(String[] args) { record Flag(String flag) { diff --git a/S53_DuplicatesFrequencyRecord.java b/S0053_DuplicatesFrequencyRecord.java similarity index 92% rename from S53_DuplicatesFrequencyRecord.java rename to S0053_DuplicatesFrequencyRecord.java index 6ae81bc..29695fa 100644 --- a/S53_DuplicatesFrequencyRecord.java +++ b/S0053_DuplicatesFrequencyRecord.java @@ -1,7 +1,7 @@ import java.util.List; import static java.util.Collections.frequency; -interface S53_DuplicatesFrequencyRecord { +interface S0053_DuplicatesFrequencyRecord { static void main(String... args) { var numbers = List.of(1, 2, 3, 3, 4, 3, 1, 2); diff --git a/S54_StreamConcat.java b/S0054_StreamConcat.java similarity index 90% rename from S54_StreamConcat.java rename to S0054_StreamConcat.java index 6d17520..6a75fcd 100644 --- a/S54_StreamConcat.java +++ b/S0054_StreamConcat.java @@ -1,7 +1,7 @@ import java.util.List; import java.util.stream.Stream; -public class S54_StreamConcat { +public class S0054_StreamConcat { public static void main(String[] args) { var first = List.of("1", "2").stream(); diff --git a/S55_FlatMap.java b/S0055_FlatMap.java similarity index 82% rename from S55_FlatMap.java rename to S0055_FlatMap.java index 110a0d1..29b4d15 100644 --- a/S55_FlatMap.java +++ b/S0055_FlatMap.java @@ -1,6 +1,6 @@ import java.util.stream.Stream; -public class S55_FlatMap { +public class S0055_FlatMap { static Stream addPrefix(String prefix) { return Stream @@ -11,7 +11,7 @@ static Stream addPrefix(String prefix) { public static void main(String[] args) { var messages = Stream .of("hey", "hi") - .flatMap(S55_FlatMap::addPrefix) + .flatMap(S0055_FlatMap::addPrefix) .toList(); System.out.println(messages); diff --git a/S56_MapMulti.java b/S0056_MapMulti.java similarity index 85% rename from S56_MapMulti.java rename to S0056_MapMulti.java index 8c68901..1a465ec 100644 --- a/S56_MapMulti.java +++ b/S0056_MapMulti.java @@ -1,7 +1,7 @@ import java.util.function.Consumer; import java.util.stream.Stream; -interface S56_MapMulti { +interface S0056_MapMulti { // 1 -> n static void expand(String csv, @@ -15,7 +15,7 @@ static void main(String... args) { .of("hello,world", "duke,java"); var expanded = csv - .mapMulti(S56_MapMulti::expand) + .mapMulti(S0056_MapMulti::expand) .toList(); System.out.println(expanded); } diff --git a/S57_FutureState.java b/S0057_FutureState.java similarity index 88% rename from S57_FutureState.java rename to S0057_FutureState.java index bf5eec4..b6563f9 100644 --- a/S57_FutureState.java +++ b/S0057_FutureState.java @@ -2,7 +2,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -interface S57_FutureState { +interface S0057_FutureState { static String slowMessage() { try { @@ -15,7 +15,7 @@ static String slowMessage() { static void main(String... args) throws InterruptedException, ExecutionException { var future = Executors .newCachedThreadPool() - .submit(S57_FutureState::slowMessage); + .submit(S0057_FutureState::slowMessage); System.out.println(future.state()); TimeUnit.SECONDS.sleep(1); diff --git a/S0058_ShortestMain.java b/S0058_ShortestMain.java new file mode 100644 index 0000000..19f4c33 --- /dev/null +++ b/S0058_ShortestMain.java @@ -0,0 +1,3 @@ +void main() { + System.out.println("hello, world"); +} \ No newline at end of file diff --git a/S59_FetchAsyncHttpClient.java b/S0059_FetchAsyncHttpClient.java similarity index 87% rename from S59_FetchAsyncHttpClient.java rename to S0059_FetchAsyncHttpClient.java index 01c1fb0..958c85b 100644 --- a/S59_FetchAsyncHttpClient.java +++ b/S0059_FetchAsyncHttpClient.java @@ -5,7 +5,7 @@ import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; -interface S59_FetchAsyncHttpClient { +interface S0059_FetchAsyncHttpClient { static void onFetch(String content) { System.out.println(content); @@ -19,7 +19,7 @@ static void fetch(URI uri) throws Exception { httpClient .sendAsync(req, BodyHandlers.ofString()) .thenApply(HttpResponse::body) - .thenAccept(S59_FetchAsyncHttpClient::onFetch); + .thenAccept(S0059_FetchAsyncHttpClient::onFetch); } } diff --git a/S60_MagicalBeanEventHandler.java b/S0060_MagicalBeanEventHandler.java similarity index 74% rename from S60_MagicalBeanEventHandler.java rename to S0060_MagicalBeanEventHandler.java index c8f84d2..45e37e7 100644 --- a/S60_MagicalBeanEventHandler.java +++ b/S0060_MagicalBeanEventHandler.java @@ -1,14 +1,14 @@ import static java.lang.System.*; import java.beans.EventHandler; -public class S60_MagicalBeanEventHandler { +public class S0060_MagicalBeanEventHandler { public void notifyDuke() { out.println("run was called"); } public static void main(String... args) { - var app = new S60_MagicalBeanEventHandler(); + var app = new S0060_MagicalBeanEventHandler(); var runnable = EventHandler.create(Runnable.class, app,"notifyDuke"); runnable.run(); } diff --git a/S61_SwitchWithRecords.java b/S0061_SwitchWithRecords.java similarity index 100% rename from S61_SwitchWithRecords.java rename to S0061_SwitchWithRecords.java diff --git a/S62_DestructuringNestedRecords.java b/S0062_DestructuringNestedRecords.java similarity index 100% rename from S62_DestructuringNestedRecords.java rename to S0062_DestructuringNestedRecords.java diff --git a/S63_ShorterInterfaceFields.java b/S0063_ShorterInterfaceFields.java similarity index 100% rename from S63_ShorterInterfaceFields.java rename to S0063_ShorterInterfaceFields.java diff --git a/S64_UnmodifiableCopyOf.java b/S0064_UnmodifiableCopyOf.java similarity index 100% rename from S64_UnmodifiableCopyOf.java rename to S0064_UnmodifiableCopyOf.java diff --git a/S65_ClipboardWasher.java b/S0065_ClipboardWasher.java similarity index 100% rename from S65_ClipboardWasher.java rename to S0065_ClipboardWasher.java diff --git a/S66_ParseVsValueOf.java b/S0066_ParseVsValueOf.java similarity index 100% rename from S66_ParseVsValueOf.java rename to S0066_ParseVsValueOf.java diff --git a/S67_ListLastElement.java b/S0067_ListLastElement.java similarity index 100% rename from S67_ListLastElement.java rename to S0067_ListLastElement.java diff --git a/S68_Block.java b/S0068_Block.java similarity index 100% rename from S68_Block.java rename to S0068_Block.java diff --git a/S69_ListFilesInDirectory.java b/S0069_ListFilesInDirectory.java similarity index 100% rename from S69_ListFilesInDirectory.java rename to S0069_ListFilesInDirectory.java diff --git a/S70_LeadingZeroFormatting.java b/S0070_LeadingZeroFormatting.java similarity index 100% rename from S70_LeadingZeroFormatting.java rename to S0070_LeadingZeroFormatting.java diff --git a/S71_CloseIOStreams.java b/S0071_CloseIOStreams.java similarity index 100% rename from S71_CloseIOStreams.java rename to S0071_CloseIOStreams.java diff --git a/S72_FlatMapWithOptional.java b/S0072_FlatMapWithOptional.java similarity index 100% rename from S72_FlatMapWithOptional.java rename to S0072_FlatMapWithOptional.java diff --git a/S73_ListOfDifferentImpls.java b/S0073_ListOfDifferentImpls.java similarity index 100% rename from S73_ListOfDifferentImpls.java rename to S0073_ListOfDifferentImpls.java diff --git a/S74_WorkingDirectory.java b/S0074_WorkingDirectory.java similarity index 100% rename from S74_WorkingDirectory.java rename to S0074_WorkingDirectory.java diff --git a/S75_get-javahome.java b/S0075_get-javahome.java similarity index 100% rename from S75_get-javahome.java rename to S0075_get-javahome.java diff --git a/S76_ConsoleYesNo.java b/S0076_ConsoleYesNo.java similarity index 93% rename from S76_ConsoleYesNo.java rename to S0076_ConsoleYesNo.java index f25bc26..9a124bf 100644 --- a/S76_ConsoleYesNo.java +++ b/S0076_ConsoleYesNo.java @@ -1,6 +1,6 @@ import java.io.Console; -public class App { +interface App { static boolean yes() { return System.console() diff --git a/S77_CreateNestedFoldersWithFile.java b/S0077_CreateNestedFoldersWithFile.java similarity index 100% rename from S77_CreateNestedFoldersWithFile.java rename to S0077_CreateNestedFoldersWithFile.java diff --git a/S78_SystemLoggerConfiguration.java b/S0078_SystemLoggerConfiguration.java similarity index 100% rename from S78_SystemLoggerConfiguration.java rename to S0078_SystemLoggerConfiguration.java diff --git a/S79_AllEmojis.java b/S0079_AllEmojis.java similarity index 100% rename from S79_AllEmojis.java rename to S0079_AllEmojis.java diff --git a/S80_ProgrammaticallyGetClasspath.java b/S0080_ProgrammaticallyGetClasspath.java similarity index 100% rename from S80_ProgrammaticallyGetClasspath.java rename to S0080_ProgrammaticallyGetClasspath.java diff --git a/S81_IsLowerCase.java b/S0081_IsLowerCase.java similarity index 100% rename from S81_IsLowerCase.java rename to S0081_IsLowerCase.java diff --git a/S82_StringToNumberTransform.java b/S0082_StringToNumberTransform.java similarity index 100% rename from S82_StringToNumberTransform.java rename to S0082_StringToNumberTransform.java diff --git a/S83_PrintEmojisWithName.java b/S0083_PrintEmojisWithName.java similarity index 100% rename from S83_PrintEmojisWithName.java rename to S0083_PrintEmojisWithName.java diff --git a/S84_ReadingIntStreams.java b/S0084_ReadingIntStreams.java similarity index 100% rename from S84_ReadingIntStreams.java rename to S0084_ReadingIntStreams.java diff --git a/S85_Beep.java b/S0085_Beep.java similarity index 100% rename from S85_Beep.java rename to S0085_Beep.java diff --git a/S86_StringToCSV.java b/S0086_StringToCSV.java similarity index 100% rename from S86_StringToCSV.java rename to S0086_StringToCSV.java diff --git a/S87_DateFormatForFileNaming.java b/S0087_DateFormatForFileNaming.java similarity index 100% rename from S87_DateFormatForFileNaming.java rename to S0087_DateFormatForFileNaming.java diff --git a/S88_EnumAsLogger.java b/S0088_EnumAsLogger.java similarity index 100% rename from S88_EnumAsLogger.java rename to S0088_EnumAsLogger.java diff --git a/S89_FileCreationTime.java b/S0089_FileCreationTime.java similarity index 86% rename from S89_FileCreationTime.java rename to S0089_FileCreationTime.java index 4085b6f..7886f7f 100644 --- a/S89_FileCreationTime.java +++ b/S0089_FileCreationTime.java @@ -6,7 +6,7 @@ interface App { static void main(String... args) throws IOException { - var path = Paths.get("./S89_FileCreationTime.java"); + var path = Paths.get("./S0089_FileCreationTime.java"); var at = Files.readAttributes(path, BasicFileAttributes.class); var creationTime = at.creationTime(); System.out.println(creationTime); diff --git a/S90_EnvEntriesWithTransform.java b/S0090_EnvEntriesWithTransform.java similarity index 100% rename from S90_EnvEntriesWithTransform.java rename to S0090_EnvEntriesWithTransform.java diff --git a/S91_CodeBlocksSingleLine.java b/S0091_CodeBlocksSingleLine.java similarity index 100% rename from S91_CodeBlocksSingleLine.java rename to S0091_CodeBlocksSingleLine.java diff --git a/S92_BiFunctionVsBinaryOperator.java b/S0092_BiFunctionVsBinaryOperator.java similarity index 100% rename from S92_BiFunctionVsBinaryOperator.java rename to S0092_BiFunctionVsBinaryOperator.java diff --git a/S93_FlattenNestedList.java b/S0093_FlattenNestedList.java similarity index 100% rename from S93_FlattenNestedList.java rename to S0093_FlattenNestedList.java diff --git a/S94_FasterFilterWithParallelStream.java b/S0094_FasterFilterWithParallelStream.java similarity index 100% rename from S94_FasterFilterWithParallelStream.java rename to S0094_FasterFilterWithParallelStream.java diff --git a/S95_ForeachVsStream.java b/S0095_ForeachVsStream.java similarity index 100% rename from S95_ForeachVsStream.java rename to S0095_ForeachVsStream.java diff --git a/S96_IsAssignableVsInstanceOf.java b/S0096_IsAssignableVsInstanceOf.java similarity index 100% rename from S96_IsAssignableVsInstanceOf.java rename to S0096_IsAssignableVsInstanceOf.java diff --git a/S97_CustomBase64Classloader.java b/S0097_CustomBase64Classloader.java similarity index 100% rename from S97_CustomBase64Classloader.java rename to S0097_CustomBase64Classloader.java diff --git a/S98_CastMethod.java b/S0098_CastMethod.java similarity index 100% rename from S98_CastMethod.java rename to S0098_CastMethod.java diff --git a/S99_MinimalisticEnumLogger.java b/S0099_MinimalisticEnumLogger.java similarity index 100% rename from S99_MinimalisticEnumLogger.java rename to S0099_MinimalisticEnumLogger.java diff --git a/S100_AutoboxingCache.java b/S0100_AutoboxingCache.java similarity index 100% rename from S100_AutoboxingCache.java rename to S0100_AutoboxingCache.java diff --git a/S100_AutoboxingCacheSizeStartupTime.java b/S0100_AutoboxingCacheSizeStartupTime.java similarity index 100% rename from S100_AutoboxingCacheSizeStartupTime.java rename to S0100_AutoboxingCacheSizeStartupTime.java diff --git a/S100_BehavioralEnums.java b/S0100_BehavioralEnums.java similarity index 100% rename from S100_BehavioralEnums.java rename to S0100_BehavioralEnums.java diff --git a/S100_BrokenCleaners.java b/S0100_BrokenCleaners.java similarity index 100% rename from S100_BrokenCleaners.java rename to S0100_BrokenCleaners.java diff --git a/S100_Cleaners.java b/S0100_Cleaners.java similarity index 100% rename from S100_Cleaners.java rename to S0100_Cleaners.java diff --git a/S100_ClockTicks.java b/S0100_ClockTicks.java similarity index 100% rename from S100_ClockTicks.java rename to S0100_ClockTicks.java diff --git a/S100_CountdownLatch.java b/S0100_CountdownLatch.java similarity index 100% rename from S100_CountdownLatch.java rename to S0100_CountdownLatch.java diff --git a/S100_CountdownLatchLoop.java b/S0100_CountdownLatchLoop.java similarity index 100% rename from S100_CountdownLatchLoop.java rename to S0100_CountdownLatchLoop.java diff --git a/S100_CustomIterableForEach.java b/S0100_CustomIterableForEach.java similarity index 100% rename from S100_CustomIterableForEach.java rename to S0100_CustomIterableForEach.java diff --git a/S100_DetectOS.java b/S0100_DetectOS.java similarity index 100% rename from S100_DetectOS.java rename to S0100_DetectOS.java diff --git a/S100_EasyFiles.java b/S0100_EasyFiles.java similarity index 69% rename from S100_EasyFiles.java rename to S0100_EasyFiles.java index 559bad8..49beafd 100644 --- a/S100_EasyFiles.java +++ b/S0100_EasyFiles.java @@ -5,8 +5,8 @@ interface App { static void main(String... args) throws IOException { - var in = Path.of("./App.java"); - var out = Path.of("./AppUpper.java"); + var in = Path.of("./S0100_EasyFiles.java"); + var out = Path.of("./_S0100_EasyFiles_CopyTarget.java"); var content = Files.readString(in).toUpperCase(); Files.writeString(out,content); } diff --git a/S100_EasyISOInstant.java b/S0100_EasyISOInstant.java similarity index 100% rename from S100_EasyISOInstant.java rename to S0100_EasyISOInstant.java diff --git a/S100_EnumConstructors.java b/S0100_EnumConstructors.java similarity index 100% rename from S100_EnumConstructors.java rename to S0100_EnumConstructors.java diff --git a/S100_EnumDefaultConstructor.java b/S0100_EnumDefaultConstructor.java similarity index 100% rename from S100_EnumDefaultConstructor.java rename to S0100_EnumDefaultConstructor.java diff --git a/S100_EnumSetComplementOf.java b/S0100_EnumSetComplementOf.java similarity index 100% rename from S100_EnumSetComplementOf.java rename to S0100_EnumSetComplementOf.java diff --git a/S100_Finalizers.java b/S0100_Finalizers.java similarity index 100% rename from S100_Finalizers.java rename to S0100_Finalizers.java diff --git a/S100_InstantParse.java b/S0100_InstantParse.java similarity index 100% rename from S100_InstantParse.java rename to S0100_InstantParse.java diff --git a/S100_Java22ListFormat.java b/S0100_Java22ListFormat.java similarity index 100% rename from S100_Java22ListFormat.java rename to S0100_Java22ListFormat.java diff --git a/S100_ListOfArraysAsList.java b/S0100_ListOfArraysAsList.java similarity index 100% rename from S100_ListOfArraysAsList.java rename to S0100_ListOfArraysAsList.java diff --git a/S100_MainInEnum.java b/S0100_MainInEnum.java similarity index 100% rename from S100_MainInEnum.java rename to S0100_MainInEnum.java diff --git a/S100_MainMethodFirst.java b/S0100_MainMethodFirst.java similarity index 100% rename from S100_MainMethodFirst.java rename to S0100_MainMethodFirst.java diff --git a/S100_MaintainabilityWithNestedEnums.java b/S0100_MaintainabilityWithNestedEnums.java similarity index 100% rename from S100_MaintainabilityWithNestedEnums.java rename to S0100_MaintainabilityWithNestedEnums.java diff --git a/S100_NicerSleep.java b/S0100_NicerSleep.java similarity index 100% rename from S100_NicerSleep.java rename to S0100_NicerSleep.java diff --git a/S100_ParallelStreamForkJoinConfiguration.java b/S0100_ParallelStreamForkJoinConfiguration.java similarity index 100% rename from S100_ParallelStreamForkJoinConfiguration.java rename to S0100_ParallelStreamForkJoinConfiguration.java diff --git a/S100_ParsingWithScanner.java b/S0100_ParsingWithScanner.java similarity index 100% rename from S100_ParsingWithScanner.java rename to S0100_ParsingWithScanner.java diff --git a/S100_Preferences.java b/S0100_Preferences.java similarity index 92% rename from S100_Preferences.java rename to S0100_Preferences.java index b09a248..719a10f 100644 --- a/S100_Preferences.java +++ b/S0100_Preferences.java @@ -1,5 +1,5 @@ import java.util.prefs.Preferences; -public interface App { +interface App { static void main(String... args) throws Exception { var root = Preferences.userRoot(); var air = root.node("air"); diff --git a/S100_ReadClassVersion.java b/S0100_ReadClassVersion.java similarity index 100% rename from S100_ReadClassVersion.java rename to S0100_ReadClassVersion.java diff --git a/S100_clock.java b/S0100_clock.java similarity index 100% rename from S100_clock.java rename to S0100_clock.java diff --git a/S101_MapOfNotEnough.java b/S0101_MapOfNotEnough.java similarity index 100% rename from S101_MapOfNotEnough.java rename to S0101_MapOfNotEnough.java diff --git a/S102_OpenURIInBrowser.java b/S0102_OpenURIInBrowser.java similarity index 100% rename from S102_OpenURIInBrowser.java rename to S0102_OpenURIInBrowser.java diff --git a/S103_AnnotationSuperclass.java b/S0103_AnnotationSuperclass.java similarity index 100% rename from S103_AnnotationSuperclass.java rename to S0103_AnnotationSuperclass.java diff --git a/S104_HtmlList.java b/S0104_HtmlList.java similarity index 100% rename from S104_HtmlList.java rename to S0104_HtmlList.java diff --git a/S105_DaysToVacations.java b/S0105_DaysToVacations.java similarity index 100% rename from S105_DaysToVacations.java rename to S0105_DaysToVacations.java diff --git a/S106_ToInstantWithoutTZ.java b/S0106_ToInstantWithoutTZ.java similarity index 100% rename from S106_ToInstantWithoutTZ.java rename to S0106_ToInstantWithoutTZ.java diff --git a/S107_DaysToVacationsDatesUntil.java b/S0107_DaysToVacationsDatesUntil.java similarity index 100% rename from S107_DaysToVacationsDatesUntil.java rename to S0107_DaysToVacationsDatesUntil.java diff --git a/S108_WeekDaysEnum.java b/S0108_WeekDaysEnum.java similarity index 100% rename from S108_WeekDaysEnum.java rename to S0108_WeekDaysEnum.java diff --git a/S109_MonthDay.java b/S0109_MonthDay.java similarity index 100% rename from S109_MonthDay.java rename to S0109_MonthDay.java diff --git a/S110_FirstMondayOfTheMonth.java b/S0110_FirstMondayOfTheMonth.java similarity index 100% rename from S110_FirstMondayOfTheMonth.java rename to S0110_FirstMondayOfTheMonth.java diff --git a/S111_TemporalQuery.java b/S0111_TemporalQuery.java similarity index 100% rename from S111_TemporalQuery.java rename to S0111_TemporalQuery.java diff --git a/S112_ExceptionsAndAbstraction.java b/S0112_ExceptionsAndAbstraction.java similarity index 100% rename from S112_ExceptionsAndAbstraction.java rename to S0112_ExceptionsAndAbstraction.java diff --git a/S113_NullsInSwitchAndIf.java b/S0113_NullsInSwitchAndIf.java similarity index 100% rename from S113_NullsInSwitchAndIf.java rename to S0113_NullsInSwitchAndIf.java diff --git a/S114_EnumToMap.java b/S0114_EnumToMap.java similarity index 100% rename from S114_EnumToMap.java rename to S0114_EnumToMap.java diff --git a/S115_ArraysStreamVsStreamOf.java b/S0115_ArraysStreamVsStreamOf.java similarity index 100% rename from S115_ArraysStreamVsStreamOf.java rename to S0115_ArraysStreamVsStreamOf.java diff --git a/S116_StringJoinVsCollectorsJoining.java b/S0116_StringJoinVsCollectorsJoining.java similarity index 100% rename from S116_StringJoinVsCollectorsJoining.java rename to S0116_StringJoinVsCollectorsJoining.java diff --git a/S117_MemoryUsage.java b/S0117_MemoryUsage.java similarity index 100% rename from S117_MemoryUsage.java rename to S0117_MemoryUsage.java diff --git a/S118_SmallestJavaRAM.java b/S0118_SmallestJavaRAM.java similarity index 100% rename from S118_SmallestJavaRAM.java rename to S0118_SmallestJavaRAM.java diff --git a/S119_1000TimesSorry.java b/S0119_1000TimesSorry.java similarity index 100% rename from S119_1000TimesSorry.java rename to S0119_1000TimesSorry.java diff --git a/S120_DaysToDevoxxWithChronoUnit.java b/S0120_DaysToDevoxxWithChronoUnit.java similarity index 100% rename from S120_DaysToDevoxxWithChronoUnit.java rename to S0120_DaysToDevoxxWithChronoUnit.java diff --git a/S121_GlobPatternMatching.java b/S0121_GlobPatternMatching.java similarity index 90% rename from S121_GlobPatternMatching.java rename to S0121_GlobPatternMatching.java index 64d05a3..08db60a 100644 --- a/S121_GlobPatternMatching.java +++ b/S0121_GlobPatternMatching.java @@ -1,7 +1,7 @@ import java.nio.file.FileSystems; import java.nio.file.Path; -interface S121_GlobPatternMatching { +interface S0121_GlobPatternMatching { static void main(String... args) { var fs = FileSystems.getDefault(); diff --git a/S122_DateTimeFormatterBuilder.java b/S0122_DateTimeFormatterBuilder.java similarity index 95% rename from S122_DateTimeFormatterBuilder.java rename to S0122_DateTimeFormatterBuilder.java index 921c705..e589c28 100644 --- a/S122_DateTimeFormatterBuilder.java +++ b/S0122_DateTimeFormatterBuilder.java @@ -7,7 +7,7 @@ import java.time.LocalTime; -interface S122_DateTimeFormatterBuilder { +interface S0122_DateTimeFormatterBuilder { static void main(String... args) { var formatter = new DateTimeFormatterBuilder() diff --git a/S123_AllTimeZones.java b/S0123_AllTimeZones.java similarity index 100% rename from S123_AllTimeZones.java rename to S0123_AllTimeZones.java diff --git a/S124_StringConcatWithReduce.java b/S0124_StringConcatWithReduce.java similarity index 85% rename from S124_StringConcatWithReduce.java rename to S0124_StringConcatWithReduce.java index dbb3d1b..6648e5d 100644 --- a/S124_StringConcatWithReduce.java +++ b/S0124_StringConcatWithReduce.java @@ -1,7 +1,7 @@ import java.util.stream.Stream; import java.util.stream.Collectors; -interface S124_StringConcatWithReduce { +interface S0124_StringConcatWithReduce { static void main(String... args) { var result = Stream diff --git a/S125_ArrayOfLambdas.java b/S0125_ArrayOfLambdas.java similarity index 100% rename from S125_ArrayOfLambdas.java rename to S0125_ArrayOfLambdas.java diff --git a/S126_StreamConcatWithStringJoin.java b/S0126_StreamConcatWithStringJoin.java similarity index 83% rename from S126_StreamConcatWithStringJoin.java rename to S0126_StreamConcatWithStringJoin.java index 9c82268..6ae518b 100644 --- a/S126_StreamConcatWithStringJoin.java +++ b/S0126_StreamConcatWithStringJoin.java @@ -2,9 +2,7 @@ import java.util.List; import java.util.stream.Collectors; -interface S126_StreamConcatWithStringJoin { - - +interface S0126_StreamConcatWithStringJoin { static void main(String... args) { var result = List diff --git a/S127_ContentEqualsOverEquals.java b/S0127_ContentEqualsOverEquals.java similarity index 79% rename from S127_ContentEqualsOverEquals.java rename to S0127_ContentEqualsOverEquals.java index 966618a..024b179 100644 --- a/S127_ContentEqualsOverEquals.java +++ b/S0127_ContentEqualsOverEquals.java @@ -1,4 +1,4 @@ -interface S127_ContentEqualsOverEquals { +interface S0127_ContentEqualsOverEquals { static void main(String... args) { var first = "duke"; diff --git a/S128_AutoboxingCache.java b/S0128_AutoboxingCache.java similarity index 100% rename from S128_AutoboxingCache.java rename to S0128_AutoboxingCache.java diff --git a/S129_AutoboxingCacheSizeStartupTime.java b/S0129_AutoboxingCacheSizeStartupTime.java similarity index 100% rename from S129_AutoboxingCacheSizeStartupTime.java rename to S0129_AutoboxingCacheSizeStartupTime.java diff --git a/S130_StreamIterate.java b/S0130_StreamIterate.java similarity index 100% rename from S130_StreamIterate.java rename to S0130_StreamIterate.java diff --git a/S03_VarArgs.java b/S03_VarArgs.java deleted file mode 100644 index d4ee76e..0000000 --- a/S03_VarArgs.java +++ /dev/null @@ -1,14 +0,0 @@ -interface S03_VarArgs { - - static void hello(String... messages) { - for (var message : messages) { - System.out.println(message); - } - } - - static void main(String... args) { - S03_VarArgs.hello("hey", "duke", "java"); - S03_VarArgs.hello("is", "working"); - S03_VarArgs.hello(new String[] { "is", "always", "working" }); - } -} \ No newline at end of file diff --git a/S18_InitializersAndConstructors.java b/S18_InitializersAndConstructors.java deleted file mode 100644 index b7fb418..0000000 --- a/S18_InitializersAndConstructors.java +++ /dev/null @@ -1,20 +0,0 @@ -public class S18_InitializersAndConstructors { - - public S18_InitializersAndConstructors() { - System.out.println("parameterless"); - } - - public S18_InitializersAndConstructors(String name) { - System.out.println(name); - } - - { - System.out.println("shared code"); - } - - - public static void main(String[] args) { - new S18_InitializersAndConstructors(); - new S18_InitializersAndConstructors("with parameter"); - } -} \ No newline at end of file diff --git a/S58_ShortestMain.java b/S58_ShortestMain.java deleted file mode 100644 index 1f69aea..0000000 --- a/S58_ShortestMain.java +++ /dev/null @@ -1,3 +0,0 @@ -void main() { - System.out.println("hello, world"); -} \ No newline at end of file