Logo
TGCATALOG
Catalog Collections Blog
Kotlin | Interview Questions

Kotlin | Interview Questions

Interview questions for Kotlin developers with answers.

No ratings
726
29.10.2026
726
29.10.2026
No ratings
726
29.10.2026
Safe redirect via bot
О канале

Interview questions for Kotlin developers with answers.

Подписчиков 2,451
Тематика Technology
Язык English
Ссылка t.me/easy_kotlin

We also recommend

Kekaton AI | Voiceover and voice clone
Kekaton AI | Voiceover and voice clone
Bot

AI bot for text-to-speech and voice cloning in Telegram. Create audio using neural network quickly and easily.

Description

Kotlin interview questions: extensions, coroutines, collections. With code examples and explanations for Android and backend.

Latest posts

Kotlin | Interview Questions
Kotlin | Interview Questions
🔒Открыть пост
и посмотреть медиа
🤔 Как в Ретрофите изменять все запросы? В Retrofit можно изменять все запросы глобально с помощью Interceptor (перехватчика) в OkHttp. Это позволяет добавлять или изменять заголовки, параметры запроса, авторизацию, логирование и многое другое. 🟠Изменение всех запросов с помощью `Interceptor` Перехватчик (Interceptor) позволяет модифицировать запрос перед его отправкой. class AuthInterceptor(private val tokenProvider: TokenProvider) : Interceptor { override fun intercept(chain: Interceptor.Chain): Response { val request = chain.request().newBuilder() .addHeader("Authorization", "Bearer ${tokenProvider.getToken()}") .addHeader("Accept", "application/json") .build() return chain.proceed(request) } } Добавляем перехватчик в OkHttpClient: val okHttpClient = OkHttpClient.Builder() .addInterceptor(AuthInterceptor(tokenProvider)) .build() val retrofit = Retrofit.Builder() .baseUrl("Ссылка скрыта .client(okHttpClient) .addConverterFactory(GsonConverterFactory.create()) .build() 🟠Добавление общих Query параметров Иногда нужно добавлять общие GET-параметры (например, API-ключ). class QueryInterceptor : Interceptor { override fun intercept(chain: Interceptor.Chain): Response { val originalRequest = chain.request() val originalUrl = originalRequest.url val newUrl = originalUrl.newBuilder() .addQueryParameter("api_key", "YOUR_API_KEY") .build() val newRequest = originalRequest.newBuilder() .url(newUrl) .build() return chain.proceed(newRequest) } } Добавляем в OkHttpClient: val okHttpClient = OkHttpClient.Builder() .addInterceptor(QueryInterceptor()) .build() 🟠Автоматическая повторная авторизация (Refresh Token) Если сервер возвращает 401 Unauthorized, можно обновить токен и повторить запрос. class AuthenticatorInterceptor(private val tokenProvider: TokenProvider) : Interceptor { override fun intercept(chain: Interceptor.Chain): Response { var request = chain.request() var response = chain.proceed(request) if (response.code == 401) { // Получаем новый токен val newToken = tokenProvider.refreshToken() // Делаем новый запрос с обновлённым токеном val newRequest = request.newBuilder() .header("Authorization", "Bearer $newToken") .build() response.close() // Закрываем старый ответ response = chain.proceed(newRequest) // Повторяем запрос } return response } } Добавляем в OkHttpClient: val okHttpClient = OkHttpClient.Builder() .addInterceptor(AuthenticatorInterceptor(tokenProvider)) .build() 🟠Логирование всех запросов Для отладки удобно логировать все запросы и ответы. val loggingInterceptor = HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY } val okHttpClient = OkHttpClient.Builder() .addInterceptor(loggingInterceptor) .build() 🟠Полностью менять `baseUrl` (динамический URL) Если в приложении нужно менять baseUrl, можно изменять его перед каждым запросом. class BaseUrlInterceptor(private val urlProvider: UrlProvider) : Interceptor { override fun intercept(chain: Interceptor.Chain): Response { val originalRequest = chain.request() val newUrl = urlProvider.getBaseUrl() + originalRequest.url.encodedPath val newRequest = originalRequest.newBuilder() .url(newUrl) .build() return chain.proceed(newRequest) } } Используем в OkHttpClient: val okHttpClient = OkHttpClient.Builder() .addInterceptor(BaseUrlInterceptor(urlProvider)) .build() Ставь 👍 и забирай 📚 Базу знаний
Kotlin | Interview Questions
FAQ

Open Kotlin | Interview Questions in Telegram and press the Start button. No separate registration is required.

Yes. The service is designed to be straightforward: open the resource, follow the on-screen instructions and start using it.

No. You can use Kotlin | Interview Questions directly in Telegram unless the resource description says otherwise.

Access depends on the resource. Check the current information in Telegram after opening Kotlin | Interview Questions.

The exact features depend on the resource. Open Kotlin | Interview Questions to see its current functions, content and access conditions.
Subscriber dynamics
+0.0% last 30 days
Current
2,451
Month ago
2,450
Average growth
+0 / day
Updated
14 hours ago

Reviews for channel Kotlin | Interview Questions

Log in to leave a review

Only registered users can share their opinion.

No reviews yet

Be the first to share your impression of this resource!

Similar resources

Loading
Switch to Light Theme
Home Catalog Collections Blog Login