print(["You are good, " + x for x in ["Zero, Jonathan"]])
#결과 #[0, 1, 2, 3, 4] #[0, 4, 6, 8] #['You are good, Zero, Jonathan'] # set comprehension print({"You are good, " + x for x in ["Zero, Zero"]})
# 결과 # {'You are good, Zero, Zero'} # dictionary comprehension score = [('merlin', 90), ('zero', 80), ('samuel', 95)] print({x[0]: x[1] for x in score})
# 결과 # {'merlin': 90, 'zero': 80, 'samuel': 95} # generator expression gen = (x+1 for x in range(5)) print(gen) print(next(gen)) print(next(gen)) print(next(gen))
# 결과 # <generator object <genexpr> at 0x103721570> # 1 # 2 # 3
여기에 sum을 사용해 lambda 처럼 비슷하게 사용할 수 있다.
print([1 for x in range(5)]) #[1, 1, 1, 1, 1] print(sum([1 for x in range(5)])) #5
NOTE:The plugins are currentlynot compatible to Gradle 5+and have not been tested with a JDK higher than 1.8. Currently a lot of issues arise related to using the plugins with Gradle 5+. There are plans to adopt the plugins to the newest Gradle API but time is lacking. Help is pretty much appreciated. Please seehttps://github.com/ewerk/gradle-plugins/milestone/1.
jdk 10+, gradle 5+를 써도 컴파일되긴 한다... 다만 안정성은 보장 못하니.. 조심하게 사용할 필요가 있다.
댓글을 달아 주세요