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 SharedResource { | |
static class Resource implements Runnable { | |
private int instanceField = 0; | |
private static int staticField = 0; | |
@Override | |
public synchronized void run() { | |
instanceField++; | |
staticField++; |
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 LocalVariable { | |
static class MyThread extends Thread { | |
@Override | |
public void run() { | |
int local = 0; | |
local++; | |
System.out.println("์ค๋ ๋ ์ด๋ฆ: " + Thread.currentThread().getName() + " ์ค๋ ๋์ ์ง์ญ ๋ณ์ : " + local); | |
} | |
} |
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
chmod +x gradlew |
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
/files/test.csv //์๋๊ฒฝ๋ก | |
classpath:/files/test.csv |
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
List<String> list = resource.stream.collect(Collectors.toList()); | |
// ๋ ๊ฐ๊ฒฐํจ | |
List<String> list = resource.stream.toList(); |
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
List<String> list = stream.collect(Collectors.toList()); | |
Set<String> set = stream.collect(Collectors.toSet()); | |
Map<Integer, String> map = stream.collect(Collectors.toMap(String::length, Function.identity())); |
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
<T, A, R> R collect(Collector<? super T, A, R> collector); | |
/** | |
* T: ์คํธ๋ฆผ์ ์์ ํ์ | |
* A: ์์ง ๊ณผ์ ์์ ์ฌ์ฉํ๋ ๋ด๋ถ ์ํ ํ์ | |
* R: ์ต์ข ์ ์ผ๋ก ์์ฑ๋๋ ๊ฒฐ๊ณผ ํ์ | |
*/ |
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 Box<T>(val value: T) | |
class Dog : Animal() | |
open class Animal | |
fun addBoxContent(box: Box<Dog>) { | |
val animalBox: Box<Animal> = box // ์ค๋ฅ ๋ฐ์ | |
} |
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 Cat : Animal() | |
open class Animal | |
class Consumer<in T> { | |
fun consume(item: T) { | |
println(item) | |
} | |
} | |
fun main() { |
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
fun main() { | |
val dogs: List<Dog> = listOf(Dog(), Dog()) | |
val animals: List<Animal> = dogs | |
printList(animals) | |
} | |
open class Animal | |
class Dog : Animal() | |
class Cat : Animal() |
NewerOlder