์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
- ์ค๋ฅ๊ฒ์ถ
- 99ํด๋ฝ
- reducible
- ํ๋ ์ ๊ตฌ์กฐ
- mariadb
- git merge
- ์ฃผ๊ธฐ์ ํธ
- tcp ์ธ๊ทธ๋จผํธ
- ๋น์ฃผ๊ธฐ์ ํธ
- IEEE 802
- ํฐ์คํ ๋ฆฌ์ฑ๋ฆฐ์ง
- ํญํด99
- ์ค๋ฅ์ ์ด
- ์๋น์ค ํ๋ฆฌ๋ฏธํฐ๋ธ
- til
- ํ๋ก์ด๋์์
- ๊ฐ๋ฐ์์ทจ์
- ์ฐ๋ถํฌdb
- ํ ํฐ ๋ฒ์ค
- leetcode
- ์ค๋ ๋
- ๊ทธ๋ฆฌ๋ ์๊ณ ๋ฆฌ์ฆ
- ์ฝ๋ฉํ ์คํธ์ค๋น
- i-type
- ์ค๋ธ์
- well known ํฌํธ
- ๋ฐ์ดํฐ ์ ์ก
- ์์๋ฒํธ
- tcp ํ๋กํ ์ฝ
- xv6
- Today
- Total
Unfazedโ๏ธ๐ฏ
์ปฌ๋ ์ ํ๋ ์์๊ณผ ํจ์ํ ์ธํฐํ์ด์ค ๋ณธ๋ฌธ
ํจ์ํ ์ธํฐํ์ด์ค๋ฅผ ์ฌ์ฉํ๋ ์ปฌ๋ ์ ํ๋ ์์์ ๋ฉ์๋
์ธํฐํ์ด์ค | ๋ฉ์๋ | ์ค๋ช |
Collection | boolean removelf(Predicate<E> filter) | ์กฐ๊ฑด์ ๋ง๋ ์์๋ฅผ ์ญ์ |
List | void replaceAll(UnaryOperator<E> operator) | ๋ชจ๋ ์์๋ฅผ ๋ณํํ์ฌ ๋์ฒด |
Iterable | void forEach(Consumer<T> action) | ๋ชจ๋ ์์์ ์์ action์ ์ํ |
Map | V compute(K key, BiFunction<K,V,V> f) | ์ง์ ๋ ํค์ ๊ฐ์ ์์ f๋ฅผ ์ํ |
V computeIfAbsent(K key, Function<K,V> f) | ํค๊ฐ ์์ผ๋ฉด, ์์ f ์ํ ํ ์ถ๊ฐ | |
V computeIfPresent(K key, Bifunction<K,V,V> f) | ์ง์ ๋ ํค๊ฐ ์์ ๋ ์์ f ์ํ | |
V merge(K key, V value, BiFunction<V,V,V> f) | ๋ชจ๋ ์์์ ๋ณํฉ์์ f ์ํ | |
void forEach(BiConsumer<K,V> action) | ๋ชจ๋ ์์์ ์์ action์ ์ํ | |
void replaceAll(Bifunction<K,V,V> f) | ๋ชจ๋ ์์์ ์นํ์์ f๋ฅผ ์ํ |
list.forEach(i->System.outprint(i+", ")); //list์ ๋ชจ๋ ์์๋ฅผ ์ถ๋ ฅ
list.removeIf(x->x%2==0 || x%3 == 0); //2 ๋๋ 3์ ๋ฐฐ์ ์ ๊ฑฐ
list.replaceAll(i->i*10); // ๋ชจ๋ ์์์ 10 ๊ณฑํ๋ค.
map.forEach((k,v)-> System.out.print("{"+k+", "+v+"} ,")); //map์ ๋ชจ๋ ์์๋ฅผ {k, v}์ ํ์์ผ๋ก ์ถ๋ ฅ
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<>();
for(int i=0; i<10; i++)
list.add(i);
//list์ ๋ชจ๋ ์์๋ฅผ ์ถ๋ ฅ
list.forEach(i->System.out.print(i+", "));
System.out.println();
//list์์ 2๋๋ 3 ๋ฐฐ์ ์ ๊ฑฐ
list.removeIf(x->x%2==0 || x%3 ==0);
System.out.println(list);
list.replaceAll(i->i*10); //list์ ๊ฐ์์์ 10์ ๊ณฑํ๋ค.
System.out.println(list);
Map<String, String> map = new HashMap<>();
map.put("1","1");
map.put("2","2");
map.put("3","3");
map.put("4","4");
//map์ ๋ชจ๋ ์์๋ฅผ {k, v}์ ํ์์ผ๋ก ์ถ๋ ฅํ๋ค.
map.forEach((k,v)->System.out.println("{"+k+","+v+"},"));
System.out.println();
Iterator it = map.entrySet().iterator();
while(it.hasNext()) {
System.out.println(it.next());
}
}
output:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
[1, 5, 7]
[10, 50, 70]
{1,1},
{2,2},
{3,3},
{4,4},
1=1
2=2
3=3
4=4
'Java' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Collection.toArray(new T[0]) vs .toArray(new T[size]) / ์ปฌ๋ ์ ์ ๋ฐฐ์ด๋ก ๋ณํํ๋ ๋ ๊ฐ์ง ๋ฐฉ๋ฒ์ ์ฑ๋ฅ ๋น๊ต (0) | 2024.01.14 |
---|---|
๋ฌธ์์ด.repeat() ๋ฌธ์์ด ๋ฐ๋ณต ๋ฉ์๋ (java.lang.String) +๋ด๋ถ ์์ค์ฝ๋ ๋ถ์ (0) | 2023.10.27 |
๋ฉ์๋ ์ฐธ์กฐ(method reference) (0) | 2023.10.06 |
Predicate์ ๊ฒฐํฉ (0) | 2023.10.06 |
java.util.function ํจํค์ง (0) | 2023.10.06 |