kotlin

Android开发如何准备技术面试(含Android面试押题)

北城余情 提交于 2020-11-26 00:39:12
今年毋庸置疑是找工作的寒冬,每一个出来找工作的同学都是值得尊敬的。现在找工作,虽然略难,但是反过来看也会逼迫我们成为更加优秀的自己。 但是不管是旺季还是寒冬,有一些优秀的同学找工作还是挺顺利的。所以说还是得提高我们自己的硬实力。 本文主要解答这些问题,如果说你想知道以下几点,就可以看下去了 当下好找工作嘛 如何写简历 如何挑选靠谱的公司 我的经验水平能拿多少的工资 问到项目中的技术难点怎么回答 2021年Android面试押题 如何和 HR 聊天,比如谈钱等等 一、当下好找工作嘛 想必大家现在经常能看到某某公司又裁员了,会担心是不是找不到工作了。其实总的来说虽然当下的环境确实不怎么好,但是有裁员的公司,也肯定有招人的公司,并且招人的公司一定比裁员的公司多得多。 那么再来回答这个问题「当下好不好找工作」。对于技术好的人来说,永远不会担心这个问题。但是对于技术不那么好的人来说,确实需要一些技巧才能比别人有更多的机会。比如说写一封清晰明了的简历,在面试前好好准备等等。 总的来说,机会是留给有准备的人。无论环境好与差,认真准备的你肯定会比别人有更多的机会。 二、如何写简历 平时有在做修改简历的收费服务,在公司里也会当个面试官啥的,总的来说也算看过很多简历了。但是大部分人的简历的套路都是一样的,项目用了什么技术栈,做了什么功能,总的来说就是流水账。 那么一旦你写出有别于这类套路的简历

Force compilation error with sealed classes

∥☆過路亽.° 提交于 2020-11-25 20:04:25
问题 With sealed classes you can use exhaustive when expressions and omit the else clause when the expression returns a result: sealed class SealedClass { class First : SealedClass() class Second : SealedClass() } fun test(sealedClass: SealedClass) : String = when (sealedClass) { is SealedClass.First -> "First" is SealedClass.Second -> "Second" } Now if I were to add a Third to SealedClass , the compiler will complain that the when expression in test() is not exhaustive, and I need to add a clause

Force compilation error with sealed classes

非 Y 不嫁゛ 提交于 2020-11-25 20:01:48
问题 With sealed classes you can use exhaustive when expressions and omit the else clause when the expression returns a result: sealed class SealedClass { class First : SealedClass() class Second : SealedClass() } fun test(sealedClass: SealedClass) : String = when (sealedClass) { is SealedClass.First -> "First" is SealedClass.Second -> "Second" } Now if I were to add a Third to SealedClass , the compiler will complain that the when expression in test() is not exhaustive, and I need to add a clause

Force compilation error with sealed classes

删除回忆录丶 提交于 2020-11-25 19:59:27
问题 With sealed classes you can use exhaustive when expressions and omit the else clause when the expression returns a result: sealed class SealedClass { class First : SealedClass() class Second : SealedClass() } fun test(sealedClass: SealedClass) : String = when (sealedClass) { is SealedClass.First -> "First" is SealedClass.Second -> "Second" } Now if I were to add a Third to SealedClass , the compiler will complain that the when expression in test() is not exhaustive, and I need to add a clause

Force compilation error with sealed classes

天涯浪子 提交于 2020-11-25 19:56:14
问题 With sealed classes you can use exhaustive when expressions and omit the else clause when the expression returns a result: sealed class SealedClass { class First : SealedClass() class Second : SealedClass() } fun test(sealedClass: SealedClass) : String = when (sealedClass) { is SealedClass.First -> "First" is SealedClass.Second -> "Second" } Now if I were to add a Third to SealedClass , the compiler will complain that the when expression in test() is not exhaustive, and I need to add a clause

Force compilation error with sealed classes

*爱你&永不变心* 提交于 2020-11-25 19:55:29
问题 With sealed classes you can use exhaustive when expressions and omit the else clause when the expression returns a result: sealed class SealedClass { class First : SealedClass() class Second : SealedClass() } fun test(sealedClass: SealedClass) : String = when (sealedClass) { is SealedClass.First -> "First" is SealedClass.Second -> "Second" } Now if I were to add a Third to SealedClass , the compiler will complain that the when expression in test() is not exhaustive, and I need to add a clause

新来的老大说,“公司以后禁止使用Lombok”,我表示反对~

亡梦爱人 提交于 2020-11-25 18:26:50
经常在其它各个地方在说公司禁止使用Lombok,我一直不明白为什么不让用,今天看到一篇文章列举了一下“缺点”,这里我只想狠狠地反驳,看到列举的理由我竟无言以对。 JDK 版本问题 当我想要将现有项目的 JDK 从 Java 8 升级到 Java 11 时,我发现 Lombok 不能正常工作了。于是我不得不将所有的 Lombok 注解从项目源代码中清除,并使用 IDE 自带的功能生成 getter/setter,equals,hashCode,toString 以及构造器等方法,你也可以使用 Delombok 工具完成这一过程。但这终究会消耗你很多的时间。 我的反驳:很多公司一旦确定JDK版本在很长的时间都不会改变(比如银行项目很多都在用jdk1.6,你问他愿意升级到jdk11不?),现在都出到14版本了,你看有多少公司会升级!如现在很多公司都在用JDK1.8,任你出到JDK14,我依然继续使用JDK1.8,等你出到JDK20时我相信Lombok肯定会支持更高的版本,那时兼容问题将不存在。 胁迫使用 当你的源代码中使用了 Lombok,恰好你的代码又被其他的人所使用,那么依赖你代码的人,也必须安装 Lombok 插件 (不管他们喜不喜欢),同时还要花费时间去了解 Lombok 注解的使用情况,如果不那么做,代码将无法正常运行。使用过 Lombok 之后,我发现这是一种很流氓的行为。

MutableLiveData: Cannot invoke setValue on a background thread from Coroutine

孤街醉人 提交于 2020-11-25 08:48:34
问题 I'm trying to trigger an update on LiveData from a coroutine: object AddressList: MutableLiveData<List<Address>>() fun getAddressesLiveData(): LiveData<List<Address>> { AddressList.value = listOf() GlobalScope.launch { AddressList.value = getAddressList() } return AddressList } but I get the following error: IllegalStateException: Cannot invoke setValue on a background thread Is there a way to make it work with coroutines? 回答1: Use liveData.postValue(value) instead of liveData.value = value .

MutableLiveData: Cannot invoke setValue on a background thread from Coroutine

亡梦爱人 提交于 2020-11-25 08:47:36
问题 I'm trying to trigger an update on LiveData from a coroutine: object AddressList: MutableLiveData<List<Address>>() fun getAddressesLiveData(): LiveData<List<Address>> { AddressList.value = listOf() GlobalScope.launch { AddressList.value = getAddressList() } return AddressList } but I get the following error: IllegalStateException: Cannot invoke setValue on a background thread Is there a way to make it work with coroutines? 回答1: Use liveData.postValue(value) instead of liveData.value = value .

MutableLiveData: Cannot invoke setValue on a background thread from Coroutine

耗尽温柔 提交于 2020-11-25 08:44:36
问题 I'm trying to trigger an update on LiveData from a coroutine: object AddressList: MutableLiveData<List<Address>>() fun getAddressesLiveData(): LiveData<List<Address>> { AddressList.value = listOf() GlobalScope.launch { AddressList.value = getAddressList() } return AddressList } but I get the following error: IllegalStateException: Cannot invoke setValue on a background thread Is there a way to make it work with coroutines? 回答1: Use liveData.postValue(value) instead of liveData.value = value .