Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[switch week2] junghyun-eunjung #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

[switch week2] junghyun-eunjung #6

wants to merge 2 commits into from

Conversation

parkje0927
Copy link
Collaborator

@parkje0927 parkje0927 commented Jan 12, 2025

week2

  • 각자 언어의 특징을 비교 설명한 뒤 내용을 정리합니다.
  • 관련하여 프로그래머스 문제를 1 ~ 2개 선택해서 풀어보고 정리합니다.
  • 3주차 ~ 4주차에는 우아한 테크 코스 문제 하나를 선택해서 풀어보고, 각자 pr 을 작성한 뒤 리뷰를 진행할 예정입니다.


- Kotlin 이란?

- (Java 동생..ㅎ)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋ cute.

Comment on lines +44 to +65
- 함수형 프로그래밍

- Java 에서 아래와 같이 Stream 을 썼다면,

```java
List<Person> personList = new ArrayList<>();

List<PersonResponse> result = personList.stream()
.filter(person -> Objects.nonNull(person.getSeq()) && Objects.nonNull(person.getName()))
.map(person -> new PersonResponse(person.getName(), person.getSeq()))
.toList();
```

- Kotlin 에서는 아래와 같이 사용할 수 있다.

```kotlin
val personList: List<Person> = listOf()

val result: List<PersonResponse> = personList
.filter { person -> person.seq != null && person.name != null }
.map { person -> PersonResponse(person.name!!, person.seq!!) }
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

신기한 자바의 스트림..

- 파일 레벨에서 간단하게 함수 선언 가능.
- Java 의 static method 를 대체할 수 있다.

### 문제
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants