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
| class ArithmeticFunction { | |
| private static enum Operation { | |
| add { | |
| @Override | |
| int apply(int a, int b) { | |
| return a + b; | |
| } | |
| }, subtract { | |
| @Override |
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 javax.imageio.IIOException; | |
| import javax.swing.*; | |
| import java.io.*; | |
| public class HyperSkill { | |
| public static void main(String[] args) { | |
| Person simon = new Person("simon", 21, new Address("stillwater", "uk")); | |
| String fileName = "C:\\users\\si_au\\desktop\\simon.data"; | |
| try { |
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
| 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 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
| 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 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 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 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.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 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 HttpUtils { | |
| private static HttpServer server; | |
| private static final String CLIENT_ID = "6edb9b1ac21042abacc6daaf0fbc4c4d"; | |
| private static final String CLIENT_SECRET = ""; // todo: remove before committing to Github. | |
| private static final String REDIRECT_ID = "http://localhost:8080"; | |
| public static void startHttpServer() { | |
| try { | |
| server = HttpServer.create(); | |
| server.bind(new InetSocketAddress(8080), 0); |
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 java.util.Scanner; | |
| class Sandwich { | |
| private String bun; | |
| private int salad; | |
| private int cheese; | |
| private int cucumber; | |
| private int ham; |
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
| // 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 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 java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.Scanner; | |
| /** | |
| * ConcreteComponent - Geek. | |
| **/ | |
| class Geek { | |
| private String type; | |
| private List<String> languages; |
NewerOlder