operandoOS
December 09, 2016
230

# Kotlinでマッチョ💪💪💪💪💪する話

Kotlinでマッチョ💪💪💪💪💪する話

Retty Tech Cafe #8
https://retty.connpass.com/event/45628/

## operandoOS

December 09, 2016

## Transcript

8. ### KotlinͷPair val pair = 1 to "pair" println(pair.first) // 1

println(pair.second) // pair
9. ### Triple΋͋ΔΑ val triple = Triple(1, true, "Triple") println(triple.first) // 1

println(triple.second) // true println(triple.third) // Triple

16. ### ͦ΋ͦ΋ PairͷtoͬͯͲ͏ͳͬͯΔΜͩ? public infix fun <A, B> <A, B>.to(that: B)

: Pair<A, B> = Pair(this, that)

20. ### Pair͔ΒTripleΛ࡞Δ֦ுؔ਺Λॻ͍ͯΈͨ infix fun <A, B, C> Pair<A, B>.to(that: C)  :

Triple<A, B, C> =   Triple(this.first, this.second, that)

22. ### ͡ΌtoͰͭͳ͛ͯॻ͍ͯΈΑ͏ val triple = 1 to true to "Triple" println(triple.first)

// 1 println(triple.second) // true println(triple.third) // Triple println(triple.javaClass) // class kotlin.Triple

26. ### 4ͭͷ஋Λ࣋ͭTuple QuartetΛ࡞Ζ͏ class Quartet<out F, out S, out T, out

FO>( val first: F, val second: S, val third: T, val fourth: FO,) { override fun toString(): String { return "Quartet(first=\$first, second=\$second,  third=\$third, fourth=\$fourth)" } }

28. ### Triple͔ΒQuartetΛ࡞Δ֦ுؔ਺Λॻ͘ infix fun <A, B, C, D> Triple<A, B, C>.to(that:

D): Quartet<A, B, C, D> =   Quartet(this.first, this.second, this.third, that)
29. ### Quartet࢖ͬͯΈΑ͏ val quartet = 1 to 10L to true to

"quartet" println(quartet.first) // 1 println(quartet.second) // 10 println(quartet.third) // true println(quartet.fourth) // quartet

32. ### 5ͭͷ஋Λ࣋ͭTuple QuintetΛ࡞Ζ͏ class Quintet<out F, out S, out T, out

FO, out FI>( val first: F, val second: S, val third: T, val fourth: FO, val five: FI) { override fun toString(): String { return "Quintet(first=\$first, second=\$second,  third=\$third, fourth=\$fourth, five=\$five)" } }

34. ### ͸͍͸͍ɺ֦ுؔ਺֦ுؔ਺ infix fun <A, B, C, D, E> Quartet<A, B,

C, D>.to(that: E): Quintet<A, B, C, D, E> = Quintet(this.first, this.second, this.third, this.fourth, that)
35. ### Quintet࢖ͬͯΈΑ͏ val quintet = 1 to 10L to true to

LocalDateTime.now() to "quintet" println(quintet.first) // 1 println(quintet.second) // 10 println(quintet.third) // true println(quintet.fourth) // 2016-12-09T19:45:38.959 println(quintet.five) // quintet

38. ### Links • Pair͔ΒTripleΛ࡞Δ֦ுؔ਺Λॻ͍ͯΈͨ - 2016/12/03ͷ30෼ KotlinϝϞ • http://hack-it-iron.hatenablog.com/entry/2016/12/03/165601 • 4ͭͱ5ͭ஋Λ࣋ͭTupleΛ࡞ͬͯΈͨ

- 2016/12/04ͷ30෼ KotlinϝϞ • http://hack-it-iron.hatenablog.com/entry/2016/12/04/223509 • TupleϥΠϒϥϦ GuildͷKotlin൛࡞ͬͯΈͨ - 2016/12/09ͷ30෼ KotlinϝϞ • http://hack-it-iron.hatenablog.com/entry/2016/12/09/172657 • Guild • https://github.com/operando/Guild/