Skip to content

Commit

Permalink
21
Browse files Browse the repository at this point in the history
  • Loading branch information
ahndmal committed Sep 25, 2023
1 parent d50287f commit 2fae3de
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions src/main/java/com/anma/java/core/twenyone/TwentyOne.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
package com.anma.java.core.twenyone;

import java.time.DayOfWeek;
import java.util.List;

import static java.time.DayOfWeek.MONDAY;
import static java.time.DayOfWeek.TUESDAY;
import static java.util.stream.Collectors.toList;

record Person(String name, int age) {
Person {
System.out.println(">> initializing Person object");
}

public int age() {
return this.age;
}

}

public class TwentyOne {

public static void main(String[] args) {

var day = TUESDAY;

int j = switch (day) {
case MONDAY -> 0;
case TUESDAY -> 1;
default -> {
int k = day.toString().length();
int result = 1000;
yield result;
}
};

}


private static void switchism() {
String name = "Ostap";

switch (name) {
Expand All @@ -33,7 +50,15 @@ public static void main(String[] args) {
};

System.out.println(result);
}


static void howMany(int k) {
switch (k) {
case 1 -> System.out.println("one");
case 2 -> System.out.println("two");
default -> System.out.println("many");
}
}

List<Person> findTopMerchants(List<Person> persons, int month) {
Expand Down

0 comments on commit 2fae3de

Please sign in to comment.