본문 바로가기
[Java8 In Action] #7 병렬 데이터 처리와 성능 [Java8 In Action] #7 병렬 데이터 처리와 성능 Java8 In Action 내용을 보며 정리한 내용입니다.정리자는 기존에 Java8 을 한차례 rough 하게 공부한 적이 있고, Kotlin 역시 공부한 적이 있습니다.위의 prerequisite 가 있는 상태에서 추가적인 내용만 정리한 내용이므로, 제대로 공부를 하고 싶다면 책을 구매해서 보길 권장합니다! 7.1. 병렬 스트림 -병렬 스트림이란 각각의 스레드에서 처리할 수 있도록 스트림 요소를 여러 청크로 분할한 스트림이다. 7.1.1. 순차 스트림을 병렬 스트림으로 변환하기 -순차 스트림에 parallel 메서드를 호출하면 병렬로 처리된다.parallelStream 에 sequential 을 호출하면 순차 스트림이 된다. -병렬 스트림.. 2018. 12. 27.
[Kotlin] 장점, 단점, 그리고 아쉬운 점 이야기 [Kotlin] 장점, 단점, 그리고 아쉬운 점 이야기 https://medium.com/keepsafe-engineering/lessons-from-converting-an-app-to-100-kotlin-68984a05dcb6https://medium.com/keepsafe-engineering/kotlin-the-good-the-bad-and-the-ugly-bf5f09b87e6f -위 링크의 글을 쓴 필자는 마켓에 출시된 Java 로 되어 있는 앱을 Kotlin 으로 전환했다.많은 사람들이 Kotlin lib 때문에 dex method limit 이 걸릴 것을 걱정하지만,실제 converting 후 proguard 적용시 method count 는 10% 줄어들고, code line 은 30% 줄.. 2018. 1. 15.
[ios] NSError** 에 대한 nullable, nonnull warning 처리 [ios] NSError** 에 대한 nullable, nonnull warning 처리 원래는 제대로 NSError** 에 대해서도 nullability 체크를 해주려면, 아래와 같이 바뀌어야 한다.(NSError**) error => (NSError* __nullable * __nullable) error 그러나 가독성이나 코드 유지 측면에서 봤을 때, 너무 좋지 않다.차라리 필요한 곳에만 nullability 를 넣고, warning 을 생성하지 않는 것이 방법일 수도 있다.이 경우에는 이를 넣어주면 된다. #pragma clang diagnostic ignored "-Wnullability-completeness" diagnostic ignored, nonnull, nonnull warning 처.. 2017. 11. 8.
[ios] Nullable & NonNull annotation [ios] Nullable & NonNull annotation -안드로이드에 보면 @Nullable, @NonNull 이라는 annotation 이 있어 API 사용에 대한 혜안을 주기 편리하다. -iOS 에도 있을까? -있다._Nullable 과 _Nonnull 이 그것이다. --(NSString* _Nullable)informationWithId:(NSString* _Nonnull)id; 위와 같은 문법으로 사용하면 된다. -_Nullable 과 _Nonnull 대신 nullable 과 nonnull 로 사용해도 된다.대신 이 경우에는 괄호의 처음에 온다.-(nullable NSString*)informationWithId:(nonnull NSString*)id; -property 에도 nullab.. 2017. 10. 30.
[Kotlin Tutorial] Kotlin 의 Type system - Chap6. The Kotlin type system [Kotlin Tutorial] Kotlin 의 Type system - Chap6. The Kotlin type system 출처 : Kotlin in action 6.1. Nullability 6.1.1. Nullable types -Kotlin 은 nullable types 를 지원한다.nullable type 이라는 것은 어떤 variable 이 null 을 가질 수 있는지를 명시하는 것이다. -nullable 하지 않은 곳에 null 을 넣으면 compile error 가 난다.기본 type 은 nullable 하지 않으며, nullable 을 만드려면 type 뒤에 ? 를 붙여주면 된다.어떤 타입이든 뒤에 ? 를 붙여줄 수 있다.fun strLenSafe(s: String?) = … 6.1.2.. 2017. 8. 18.
[android] 추가된 유용한 annotations [android] 추가된 유용한 annotations http://tools.android.com/tech-docs/support-annotationshttps://developer.android.com/reference/android/support/annotation/package-summary.html -Android support library 19.1 version 에서 annotation 들을 추가했다. -이 녀석을 사용하려면 gradle 에 다음을 추가해야 한다. compile ‘com.android.support:support-annotations:20.0.0’ 여기서는 크게 3가지 형태의 annotation 을 제공한다. 1. Nullness annotattions2. Resource ty.. 2017. 8. 2.
@NotNull annotation 의 장점 @NotNull annotation 의 장점 http://robaustin.wikidot.com/annotations-and-notnullhttps://www.jetbrains.com/idea/documentation/howto.html - Find Bugs 와 IntelliJ 는 null check annotation 을 지원한다. 코드 가독성 측면에서 좋지 않다는 이야기도 있지만, 그건 케바케. - function 의 param 에 null 이 들어오면 RuntimeException 을 던지도록 처리하는 것이 좋다.public void testMethodNotNull( @NotNull String param ){ // do sth.}만약 method 선언부에 @NotNull 을 선언하면, valida.. 2015. 6. 23.
반응형