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 ArithmeticFunction { | |
private static enum Operation { | |
add { | |
@Override | |
int apply(int a, int b) { | |
return a + b; | |
} | |
}, subtract { | |
@Override |
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
plugins { | |
id 'org.springframework.boot' version '2.3.1.RELEASE' | |
id 'io.spring.dependency-management' version '1.0.9.RELEASE' | |
id 'java' | |
} | |
group = 'io.github.siaust' | |
version = '0.0.1-SNAPSHOT' | |
sourceCompatibility = '1.8' |
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
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.example.web_quiz_app.WebQuizAppApplication]; | |
nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: | |
Annotation-specified bean name 'securityConfig' for bean class [com.example.web_quiz_app.Security.SecurityConfig] | |
conflicts with existing, non-compatible bean definition of same name and class [io.github.siaust.web_quiz_app.Config.SecurityConfig] | |
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE |
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 static List<Integer> sortOddEven(List<Integer> numbers) { | |
// sort odd and even | |
// then sort odd asc, even desc | |
Comparator<Integer> byOddFirst = (i1, i2) -> (i1 | 1) == i1 ? -1 : (i2 | 1) > i2 ? 1 : 0; | |
Comparator<Integer> byOddAscEvenDesc = (i1, i2) -> { | |
if ((i1 | 1) == i1 && (i2 | 1) == i2) { | |
return Integer.compare(i1, i2); | |
} else if ((i1 | 1) > i1 && (i2 | 1) > i2) { | |
return Integer.compare(i1, i2) * -1; |
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.Test; | |
import static org.junit.Assert.assertEquals; | |
import java.util.Arrays; | |
public class JUnitTest { | |
@Test | |
public void CalculatorTest() { | |
Calculator calculator = new Calculator(); | |
assertEquals(10, calculator.sum("1234")); |
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 java.util.Scanner; | |
class Sandwich { | |
private String bun; | |
private int salad; | |
private int cheese; | |
private int cucumber; | |
private int ham; |
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
// Do not remove imports | |
import java.lang.reflect.Field; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.ParameterizedType; | |
import java.lang.reflect.WildcardType; | |
import java.util.Set; | |
import java.util.Scanner; | |
class ListParameterInspector { | |
// Do not change the method |
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 java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
/** | |
* ConcreteComponent - Geek. | |
**/ | |
class Geek { | |
private String type; | |
private List<String> languages; |
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 java.util.Scanner; | |
class Robot { | |
private String CPU; | |
private int legs; | |
private int hands; | |
private int eyes; | |
Robot(String CPU, int legs, int hands, int eyes) { |
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 Move { | |
public static void main(String[] args) { | |
Robot robot = new Robot(0,0, Direction.UP); | |
System.out.printf("robotX: %d robotY: %d\n", robot.getX(), robot.getY()); | |
moveRobot(robot, 10, 0); | |
System.out.printf("robotX: %d robotY: %d\n", robot.getX(), robot.getY()); | |
} | |
public static void moveRobot(Robot robot, int toX, int toY) { |
NewerOlder