Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify numbering to four digits #2 #3

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion S00_BoringMain.java → S0000_BoringMain.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public class S00_BoringMain {
public class S0000_BoringMain {

public static void main(String[] args) {
System.out.println("boring and complex");
Expand Down
2 changes: 1 addition & 1 deletion S01_Executable.java → S0001_Executable.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public interface S01_Executable {
public interface S0001_Executable {

static void main(String... args) {
System.out.println("hello,duke");
Expand Down
2 changes: 1 addition & 1 deletion S02_MainInterface.java → S0002_MainInterface.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface S02_MainInterface {
interface S0002_MainInterface {

static void main(String... args) {
System.out.println("hello,duke");
Expand Down
14 changes: 14 additions & 0 deletions S0003_VarArgs.java
Original file line number Diff line number Diff line change
@@ -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" });
}
}
2 changes: 1 addition & 1 deletion S04_Timer.java → S0004_Timer.java
Original file line number Diff line number Diff line change
@@ -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() {

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
2 changes: 1 addition & 1 deletion S06_FileWatch.java → S0006_FileWatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
6 changes: 3 additions & 3 deletions S07_FileDiff.java → S0007_FileDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion S08_CopyToClipboard.java → S0008_CopyToClipboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion S10_ReadFromConsole.java → S0010_ReadFromConsole.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public class S10_ReadFromConsole {
public class S0010_ReadFromConsole {

public static void main(String[] args) {
var console = System.console();
Expand Down
2 changes: 1 addition & 1 deletion S11_ReadPassword.java → S0011_ReadPassword.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public class S11_ReadPassword {
public class S0011_ReadPassword {

public static void main(String[] args) {
var console = System.console();
Expand Down
2 changes: 1 addition & 1 deletion S12_CustomJVM.java → S0012_CustomJVM.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public interface S12_CustomJVM {
public interface S0012_CustomJVM {

/**
* javac
Expand Down
3 changes: 2 additions & 1 deletion S13_Emoji.java → S0013_Emoji.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
public class S13_Emoji {
public class S0013_Emoji {

static final String ROCKET = "🚀";

public static void main(String[] args) {
Expand Down
2 changes: 1 addition & 1 deletion S14_SystemOutInColor.java → S0014_SystemOutInColor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion S15_BuiltInLogger.java → S0015_BuiltInLogger.java
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
4 changes: 2 additions & 2 deletions S16_AutoCloseable.java → S0016_AutoCloseable.java
Original file line number Diff line number Diff line change
@@ -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()) {
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class S17_StaticInitializer{
class S0017_StaticInitializer{
static{
System.out.println("s1");
}
Expand Down
20 changes: 20 additions & 0 deletions S0018_InitializersAndConstructors.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
2 changes: 1 addition & 1 deletion S20_Assert.java → S0020_Assert.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion S21_TerminalReset.java → S0021_TerminalReset.java
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public class S23_UnderscoresInNumbers {
public class S0023_UnderscoresInNumbers {

public static void main(String[] args) {
var number = 10_000_000;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

@FunctionalInterface
interface S24_FunctionalInterface {
interface S0024_FunctionalInterface {
void first();
}
2 changes: 1 addition & 1 deletion S25_Sam.java → S0025_Sam.java
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import static java.util.Optional.ofNullable;

interface S26_AttributeDefaultOptional {
interface S0026_AttributeDefaultOptional {

class Developer {
private String name;
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion S28_Formatted.java → S0028_Formatted.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public class S28_Formatted {
public class S0028_Formatted {

public static void main(String[] args) {
var message = """
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public class S29_PositionInFormatted {
public class S0029_PositionInFormatted {

public static void main(String[] args) {
var message = """
Expand Down
2 changes: 1 addition & 1 deletion S30_CreateTempFolder.java → S0030_CreateTempFolder.java
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion S32_DirectoryStream.java → S0032_DirectoryStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion S33_Capitalize.java → S0033_Capitalize.java
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion S35_LinesString.java → S0035_LinesString.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public class S35_LinesString {
public class S0035_LinesString {

public static void main(String[] args) {
var result = """
Expand Down
2 changes: 1 addition & 1 deletion S37_FileCopy.java → S0037_FileCopy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion S39_EndlessStreams.java → S0039_EndlessStreams.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion S40_SoutRedirect.java → S0040_SoutRedirect.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion S41_TimeVsChronoUnit.java → S0041_TimeVsChronoUnit.java
Original file line number Diff line number Diff line change
@@ -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?");
Expand Down
2 changes: 1 addition & 1 deletion S42_IntegerCaching.java → S0042_IntegerCaching.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface S42_IntegerCaching {
interface S0042_IntegerCaching {

static void main(String... args) {
var number = 128;
Expand Down
2 changes: 1 addition & 1 deletion S43_JWTDecoder.java → S0043_JWTDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion S44_Ternary.java → S0044_Ternary.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface S44_Ternary {
interface S0044_Ternary {

static void main(String... args) {
var input = "";
Expand Down
2 changes: 1 addition & 1 deletion S45_Peek.java → S0045_Peek.java
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
2 changes: 1 addition & 1 deletion S50_CrazyQuestion.java → S0050_CrazyQuestion.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface S50_CrazyQuestion {
interface S0050_CrazyQuestion {

static void main(String... args) {

Expand Down
2 changes: 1 addition & 1 deletion S51_Frequency.java → S0051_Frequency.java
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Loading