Apache Library - StringUtils Class StringUtils (Apache Commons Lang 3.9 API) isBlank(), isEmpty() ์ธ์๋ ์ฐธ ๋ง์ ํธ๋ฆฌํ ๋ฉ์๋๋ค์ด ์กด์ฌํ๋ค. ์์งํ๊ณ ์ ์ฉํ๊ฒ ์ฌ์ฉํ์ ! dependency ์ถ๊ฐ compile 'org.apache.commons:commons-lang3:3.0' import (๋ณดํต auto-import ๋จ) import org.apache.commons.lang3.StringUtils; isBlank() vs isEmpty() ์ถ๊ฐ๋ก, java.lang.String์ isBlank(), isEmpty()๋ null๊ฐ์ ์ฒ๋ฆฌํ์ง ๋ชปํ๋ค. ์ฐธ๊ณ ํ ๋งํ ๋งํฌ tistory/Java-StringUtils
DTO vs VO (Data Transfer Object / Value Object) ์ฉ๋๋ ๋น์ทํ๋, ๊ฐ๋จํ DTO๋ variable / VO๋ value ๊ฐ์ ๋๋ ๋๋ค๋ฅธ ํํ์ผ๋ก๋, DTO๋ Instance / VO๋ Literal ๊ฐ์ ๋๋ (๋๋๋ง!) DTOVOData Transfer ObjectValue Objectํ๋ก์ธ์ค๊ฐ ๋ฐ์ดํฐ๋ฅผ ์ ๋ฌํ๋ ๊ฐ์ฒด๊ฐ๋จํ ๋ ๋ฆฝ์ฒด(Entity)๋ฅผ ์๋ฏธํ๋ ์์ ๊ฐ์ฒด์ฌ์ค์ ์ฉ๋๋ ๋๋ค ๋๋ฉ์ธ๋จ์์ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ๋ ๋น์ทํ ์ฉ๋์ํ ๋ณ๊ฒฝ ๊ฐ๋ฅRead-Only : ํ๋ฒ ๊ฐ์ ์ด๊ธฐํํ๋ฉด ๋ณ๊ฒฝ๋ถ๊ฐBusiness logic๊น์ง ๋ด์์ ์ฌ์ฉํ๊ธฐ๋.equals()๋ก ๋น๊ตํ ๋, ๋ชจ๋ ๊ฐ์ ๋น๊ตํด์ผํ๋คex) ๋ณดํต "CarDto"์ ๊ฐ์ด ํด๋์ค์ด๋ฆ์ ์ ๋ฏธ์ฌ๋ก ์ฉ๋๋ฅผ ๋ํ๋ธ๋ค ์ต๋ํ ..
TDD์ ๋จ์ํ ์คํธ๋ ๋ค๋ฅด๋ค. ๋จ์ํ ์คํธ๋ก ๋จผ์ ์ฐ์ตํ๊ณ TDD์ ์ ์ฐจ ์ต์ํด์ง์. ์ถ์ฒ์์ Unit Test (๋จ์ ํ ์คํธ) โ Production code โ Test code => JUnit Annotation์ ํ์ฉ JUnit 5.x import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class CalculatorTest { Calculator cal; @BeforeEach public void setUp() { cal = ..
package ๊ด๋ จ๋ ํด๋์ค๋ค์ ๋ชจ์์ ๊ด๋ฆฌํ ์ ์๋๋ก ํ๋ค. ํ ๊ณณ์์ ์๋ฐฑ, ์์ฒ ๊ฐ์ ํด๋์ค๋ฅผ ์ฐพ๋ ์๊ณ ๋ฅผ ๋์ด์ค๋ค. ๋ฐฐํฌํ ๋ ๊ด๋ จ๋ ์์ค ์ฝ๋๋ค์ ๋ฌถ์ด์ ๋ฐฐํฌํ๊ณ ์ฌ์ฌ์ฉํ ์ ์๋๋ก ํ๋ค. ๊ฐ ํ๋ก์ ํธ๋ ์ํํธ์จ์ด ๊ฐ์ ์์ค ์ฝ๋ ์ถฉ๋์ ๋ฐฉ์งํ๋ค. โ Package Convention ์ผ๋ฐ์ ์ผ๋ก ํจํค์ง๋ช ์ ํ์ฌ ๋๋ฉ์ธ๋ช ์ ์ฌ์ฉํ๋ค ๋ชจ๋ ํจํค์ง ์ด๋ฆ์ ์๋ฌธ์ ํจํค์ง๋ช ์ด java์ javax๋ก ์์ํด์ ์๋๋ค. ์ด ๋์ JDK์์ ๋ ์ ์ ์ผ๋ก ์ฌ์ฉ์ค ๋ณดํต src/main/java/.. , src/test/java/.. ํํ โ import ๋ชจ๋ ํด๋์ค์์ ํจํค์ง๋ช ์ ์ฌ์ฉํ๋ ๊ฒ์ ๋นํจ์จ์ . java.util.Scanner sc = new java.util.Scanner(System.in); impo..
public class Calculator { public static int plus(int num1, int num2) { return num1 + num2; } public static int minus(int num1, int num2) { return num1- num2; } public static int multiply(int num1, int num2) { return num1 * num2; } public static int divide(int num1, int num2) { return num1 / num2; } }// public class StringCalculator private int map(int num1, int num2, String operator) { if (opera..
What Is a Main Class in Java? ์์ฝ Java์ main์ ๊ธฐ๋ณธ ํน์ฑ : main()์ Java Program์ entry point๋ก ์ด๋์์๋ ์คํ๋ ์์๋ค. ์ด๋๋ (any class that is part of app.) ์์นํ ์์๊ณ . main()์ ๊ธฐ๋ฅ์, just start action - not actually perform it. Generally, the main() method parses any command line arguments, does some setup or checking, and then initializes one or more objects that continue the work of the program. main์ด ๋ค๋ฅธ ํด๋์ค์ ํฉ์ณ์ ธ์ผํ๋ค ..
public class test { public static void main(String args[]) { //System.out.println("test"); Thread1 t1 = new Thread1(); Thread2 t2 = new Thread2(); t1.start(); t2.start(); try { t1.sleep(2000); } catch (InterruptedException e) {} System.out.print(""); } } class Thread1 extends Thread { public void run() { for(int i=0 ;i
โ ๊ธฐ๋ณธ์ ์ธ @BeforeEach > @Test > @AfterEach ์์ ์ฝ๋์ํ ํ๋ฆ โ assertThat().isEqualTo() (๋ฌผ๋ก @Test ๋ฉ์๋๊ฐ ์ฌ๋ฌ๊ฐ๋ผ๋ฉด, ๊ฐ @Test ๋ฉ์๋ ์ ํ๋ก @Before/AfterEach ๋ฉ์๋๊ฐ ์ค๋ณต ์ํ๋จ) public class CalculatorTest { StringCalculator stringCalculator; @BeforeEach void setUp() { stringCalculator = new StringCalculator(); } @Test void ๋ณตํฉ_๊ณ์ฐ() { assertThat(stringCalculator.calculate("5 * 2 + 2")).isEqualTo(12); assertThat(stringCalculato..
- Total
- Today
- Yesterday
- Android
- C
- ๊ฐ๋ฐ์
- FRAGMENT
- javascript
- bfs
- Android Studio
- brute-force
- queue
- git
- ์ฐ์ํ ํ ํฌ์ฝ์ค
- Vo
- dfs
- sort
- ๋ฆฌ๋ฒ์ฑ
- socket
- Java
- OneToMany
- ํ๋ก๊ทธ๋๋จธ์ค
- Data Structure
- reversing
- Stack
- ์นํดํน
- mysql
- Algorithm
- ํ๊ณ
- graph
- webhacking.kr
- ํด์ธ์ฌํ
- JPA
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |