package yitian.study.skilled

fun main(args: Array<String>) {

    //获取订单数最多的顾客
    val customerOfMaxOrder = orders().groupBy { it.customer }
            .maxBy { it.value.size }
            ?.key
    println("获取订单数最多的顾客:$customerOfMaxOrder")

    //获取订单金额最多的顾客
    val customerOfMaxOrderPrice = orders().groupBy { it.customer }
            .maxBy { it.value.sumByDouble { it.products.sumByDouble { it.price } } }
            ?.key
    println("获取订单金额最多的顾客:$customerOfMaxOrderPrice")

    //价格最贵的商品
    val mostExpensiveProduct = products().maxBy { it.price }
    println("价格最贵的商品:$mostExpensiveProduct")

    //计算机类的所有商品
    val productsOfComputer = products().filter { it.category == Category.Computer }
    println("计算机类的所有商品:$productsOfComputer")

    //最便宜的三件商品
    val productsOfCheapestThree = products().sortedBy { it.price }
            .filterIndexed({ index, _ -> index < 3 })
    println("最便宜的三件商品:$productsOfCheapestThree")

    //每个顾客购买的商品列表
    val productsOfCustomers = orders().groupBy { it.customer }
            .map { it.value.map { it.products }.flatten() }
    //每位顾客都购买了的商品
    val productsOfEveryCustomer = productsOfCustomers.fold(products(), {
        result, products ->
        result.intersect(products).toList()
    })
    println("每位顾客都购买了的商品:$productsOfEveryCustomer")
}

data class Product(val name: String, val price: Double, val category: Category)
data class City(val name: String)
data class Customer(val name: String, val city: City) {
    override fun toString(): String {
        return "Customer(name=$name, city=$city)"
    }
}

data class Order(val products: List<Product>, val customer: Customer)
enum class Category {
    Computer, Education, Game
}

fun cities(): List<City> {
    return listOf(City("呼和浩特")
            , City("北京")
            , City("上海")
            , City("天津")
            , City("武汉"))
}

fun products(): List<Product> {
    return listOf(Product("Intel Core i7-7700k", 2799.00, Category.Computer),
            Product("AMD Ryzen 7 1700", 2499.0, Category.Computer),
            Product("Counter Strike", 10.0, Category.Game),
            Product("Batman", 79.0, Category.Game),
            Product("Thinking in Java", 59.0, Category.Education),
            Product("C# Programming", 99.0, Category.Education)
    )
}

fun customers(): List<Customer> {
    return listOf(Customer("易天", cities()[0])
            , Customer("张三", cities()[1])
            , Customer("李四", cities()[2])
            , Customer("沪生", cities()[3])
            , Customer("王五", cities()[4]))
}

fun orders(): List<Order> {
    return listOf(Order(products().subList(0, 3), customers()[0])
            , Order(products().subList(3, products().size), customers()[0])
            , Order(products().subList(1, 3), customers()[1])
            , Order(products().subList(2, 4), customers()[2])
            , Order(products().subList(0, 4), customers()[3])
            , Order(products().subList(1, 5), customers()[4])
    )
}

Compiled from "Comparisons.kt"
public final class yitian.study.skilled.CollectionsKt$main$$inlined$sortedBy$1<T> implements java.util.Comparator {
  public yitian.study.skilled.CollectionsKt$main$$inlined$sortedBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class yitian/study/skilled/Product
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method yitian/study/skilled/Product.getPrice:()D
      12: invokestatic  #33                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      15: checkcast     #35                 // class java/lang/Comparable
      18: aload_2
      19: checkcast     #23                 // class yitian/study/skilled/Product
      22: astore_3
      23: astore        5
      25: iconst_0
      26: istore        4
      28: aload_3
      29: invokevirtual #27                 // Method yitian/study/skilled/Product.getPrice:()D
      32: invokestatic  #33                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      35: aload         5
      37: swap
      38: checkcast     #35                 // class java/lang/Comparable
      41: invokestatic  #41                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      44: ireturn
}

Compiled from "collections.kt"
public final class yitian.study.skilled.CollectionsKt {
  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #9                  // String args
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: invokestatic  #19                 // Method orders:()Ljava/util/List;
       9: checkcast     #21                 // class java/lang/Iterable
      12: astore_3
      13: iconst_0
      14: istore        4
      16: aload_3
      17: astore        5
      19: new           #23                 // class java/util/LinkedHashMap
      22: dup
      23: invokespecial #27                 // Method java/util/LinkedHashMap."<init>":()V
      26: checkcast     #29                 // class java/util/Map
      29: astore        6
      31: iconst_0
      32: istore        7
      34: aload         5
      36: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      41: astore        8
      43: aload         8
      45: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      50: ifeq          155
      53: aload         8
      55: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      60: astore        10
      62: aload         10
      64: checkcast     #45                 // class yitian/study/skilled/Order
      67: astore        11
      69: iconst_0
      70: istore        13
      72: aload         11
      74: invokevirtual #49                 // Method yitian/study/skilled/Order.getCustomer:()Lyitian/study/skilled/Customer;
      77: astore        14
      79: aload         6
      81: astore        15
      83: iconst_0
      84: istore        16
      86: aload         15
      88: aload         14
      90: invokeinterface #53,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      95: astore        17
      97: aload         17
      99: ifnonnull     134
     102: iconst_0
     103: istore        18
     105: new           #55                 // class java/util/ArrayList
     108: dup
     109: invokespecial #56                 // Method java/util/ArrayList."<init>":()V
     112: checkcast     #58                 // class java/util/List
     115: astore        18
     117: aload         15
     119: aload         14
     121: aload         18
     123: invokeinterface #62,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     128: pop
     129: aload         18
     131: goto          136
     134: aload         17
     136: nop
     137: checkcast     #58                 // class java/util/List
     140: astore        11
     142: aload         11
     144: aload         10
     146: invokeinterface #66,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     151: pop
     152: goto          43
     155: aload         6
     157: nop
     158: invokeinterface #70,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     163: checkcast     #21                 // class java/lang/Iterable
     166: astore        4
     168: aload         4
     170: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     175: astore        5
     177: aload         5
     179: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     184: ifne          195
     187: new           #72                 // class java/util/NoSuchElementException
     190: dup
     191: invokespecial #73                 // Method java/util/NoSuchElementException."<init>":()V
     194: athrow
     195: aload         5
     197: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     202: astore        6
     204: aload         5
     206: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     211: ifne          219
     214: aload         6
     216: goto          309
     219: aload         6
     221: checkcast     #75                 // class java/util/Map$Entry
     224: astore        7
     226: iconst_0
     227: istore        8
     229: aload         7
     231: invokeinterface #78,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     236: checkcast     #58                 // class java/util/List
     239: invokeinterface #82,  1           // InterfaceMethod java/util/List.size:()I
     244: istore        7
     246: aload         5
     248: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     253: astore        8
     255: aload         8
     257: checkcast     #75                 // class java/util/Map$Entry
     260: astore        10
     262: iconst_0
     263: istore        11
     265: aload         10
     267: invokeinterface #78,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     272: checkcast     #58                 // class java/util/List
     275: invokeinterface #82,  1           // InterfaceMethod java/util/List.size:()I
     280: istore        10
     282: iload         7
     284: iload         10
     286: if_icmpge     297
     289: aload         8
     291: astore        6
     293: iload         10
     295: istore        7
     297: aload         5
     299: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     304: ifne          246
     307: aload         6
     309: checkcast     #75                 // class java/util/Map$Entry
     312: astore_2
     313: aload_2
     314: ifnull        329
     317: aload_2
     318: invokeinterface #85,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     323: checkcast     #87                 // class yitian/study/skilled/Customer
     326: goto          330
     329: aconst_null
     330: astore_1
     331: new           #89                 // class java/lang/StringBuilder
     334: dup
     335: invokespecial #90                 // Method java/lang/StringBuilder."<init>":()V
     338: ldc           #92                 // String 获取订单数最多的顾客:
     340: invokevirtual #96                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     343: aload_1
     344: invokevirtual #99                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     347: invokevirtual #103                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     350: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
     353: swap
     354: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     357: invokestatic  #19                 // Method orders:()Ljava/util/List;
     360: checkcast     #21                 // class java/lang/Iterable
     363: astore        4
     365: iconst_0
     366: istore        5
     368: aload         4
     370: astore        6
     372: new           #23                 // class java/util/LinkedHashMap
     375: dup
     376: invokespecial #27                 // Method java/util/LinkedHashMap."<init>":()V
     379: checkcast     #29                 // class java/util/Map
     382: astore        7
     384: iconst_0
     385: istore        8
     387: aload         6
     389: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     394: astore        10
     396: aload         10
     398: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     403: ifeq          508
     406: aload         10
     408: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     413: astore        11
     415: aload         11
     417: checkcast     #45                 // class yitian/study/skilled/Order
     420: astore        13
     422: iconst_0
     423: istore        14
     425: aload         13
     427: invokevirtual #49                 // Method yitian/study/skilled/Order.getCustomer:()Lyitian/study/skilled/Customer;
     430: astore        15
     432: aload         7
     434: astore        16
     436: iconst_0
     437: istore        17
     439: aload         16
     441: aload         15
     443: invokeinterface #53,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     448: astore        18
     450: aload         18
     452: ifnonnull     487
     455: iconst_0
     456: istore        19
     458: new           #55                 // class java/util/ArrayList
     461: dup
     462: invokespecial #56                 // Method java/util/ArrayList."<init>":()V
     465: checkcast     #58                 // class java/util/List
     468: astore        19
     470: aload         16
     472: aload         15
     474: aload         19
     476: invokeinterface #62,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     481: pop
     482: aload         19
     484: goto          489
     487: aload         18
     489: nop
     490: checkcast     #58                 // class java/util/List
     493: astore        13
     495: aload         13
     497: aload         11
     499: invokeinterface #66,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     504: pop
     505: goto          396
     508: aload         7
     510: nop
     511: invokeinterface #70,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     516: checkcast     #21                 // class java/lang/Iterable
     519: astore        5
     521: aload         5
     523: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     528: astore        6
     530: aload         6
     532: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     537: ifne          548
     540: new           #72                 // class java/util/NoSuchElementException
     543: dup
     544: invokespecial #73                 // Method java/util/NoSuchElementException."<init>":()V
     547: athrow
     548: aload         6
     550: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     555: astore        7
     557: aload         6
     559: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     564: ifne          572
     567: aload         7
     569: goto          941
     572: aload         7
     574: checkcast     #75                 // class java/util/Map$Entry
     577: astore        8
     579: iconst_0
     580: istore        10
     582: aload         8
     584: invokeinterface #78,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     589: checkcast     #21                 // class java/lang/Iterable
     592: astore        11
     594: iconst_0
     595: istore        13
     597: dconst_0
     598: dstore        14
     600: aload         11
     602: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     607: astore        16
     609: aload         16
     611: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     616: ifeq          732
     619: aload         16
     621: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     626: astore        17
     628: dload         14
     630: aload         17
     632: checkcast     #45                 // class yitian/study/skilled/Order
     635: astore        18
     637: dstore        19
     639: iconst_0
     640: istore        21
     642: aload         18
     644: invokevirtual #118                // Method yitian/study/skilled/Order.getProducts:()Ljava/util/List;
     647: checkcast     #21                 // class java/lang/Iterable
     650: astore        22
     652: iconst_0
     653: istore        23
     655: dconst_0
     656: dstore        24
     658: aload         22
     660: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     665: astore        26
     667: aload         26
     669: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     674: ifeq          717
     677: aload         26
     679: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     684: astore        27
     686: dload         24
     688: aload         27
     690: checkcast     #120                // class yitian/study/skilled/Product
     693: astore        28
     695: dstore        29
     697: iconst_0
     698: istore        31
     700: aload         28
     702: invokevirtual #124                // Method yitian/study/skilled/Product.getPrice:()D
     705: dstore        32
     707: dload         29
     709: dload         32
     711: dadd
     712: dstore        24
     714: goto          667
     717: dload         24
     719: nop
     720: dstore        34
     722: dload         19
     724: dload         34
     726: dadd
     727: dstore        14
     729: goto          609
     732: dload         14
     734: nop
     735: dstore        8
     737: aload         6
     739: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     744: astore        10
     746: aload         10
     748: checkcast     #75                 // class java/util/Map$Entry
     751: astore        11
     753: iconst_0
     754: istore        13
     756: aload         11
     758: invokeinterface #78,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     763: checkcast     #21                 // class java/lang/Iterable
     766: astore        36
     768: iconst_0
     769: istore        37
     771: dconst_0
     772: dstore        38
     774: aload         36
     776: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     781: astore        18
     783: aload         18
     785: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     790: ifeq          906
     793: aload         18
     795: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     800: astore        40
     802: dload         38
     804: aload         40
     806: checkcast     #45                 // class yitian/study/skilled/Order
     809: astore        41
     811: dstore        42
     813: iconst_0
     814: istore        23
     816: aload         41
     818: invokevirtual #118                // Method yitian/study/skilled/Order.getProducts:()Ljava/util/List;
     821: checkcast     #21                 // class java/lang/Iterable
     824: astore        44
     826: iconst_0
     827: istore        45
     829: dconst_0
     830: dstore        46
     832: aload         44
     834: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     839: astore        28
     841: aload         28
     843: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     848: ifeq          891
     851: aload         28
     853: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     858: astore        48
     860: dload         46
     862: aload         48
     864: checkcast     #120                // class yitian/study/skilled/Product
     867: astore        49
     869: dstore        50
     871: iconst_0
     872: istore        34
     874: aload         49
     876: invokevirtual #124                // Method yitian/study/skilled/Product.getPrice:()D
     879: dstore        52
     881: dload         50
     883: dload         52
     885: dadd
     886: dstore        46
     888: goto          841
     891: dload         46
     893: nop
     894: dstore        54
     896: dload         42
     898: dload         54
     900: dadd
     901: dstore        38
     903: goto          783
     906: dload         38
     908: nop
     909: dstore        11
     911: dload         8
     913: dload         11
     915: invokestatic  #130                // Method java/lang/Double.compare:(DD)I
     918: ifge          929
     921: aload         10
     923: astore        7
     925: dload         11
     927: dstore        8
     929: aload         6
     931: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     936: ifne          737
     939: aload         7
     941: checkcast     #75                 // class java/util/Map$Entry
     944: astore_3
     945: aload_3
     946: ifnull        961
     949: aload_3
     950: invokeinterface #85,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     955: checkcast     #87                 // class yitian/study/skilled/Customer
     958: goto          962
     961: aconst_null
     962: astore_2
     963: new           #89                 // class java/lang/StringBuilder
     966: dup
     967: invokespecial #90                 // Method java/lang/StringBuilder."<init>":()V
     970: ldc           #132                // String 获取订单金额最多的顾客:
     972: invokevirtual #96                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     975: aload_2
     976: invokevirtual #99                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     979: invokevirtual #103                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     982: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
     985: swap
     986: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     989: invokestatic  #135                // Method products:()Ljava/util/List;
     992: checkcast     #21                 // class java/lang/Iterable
     995: astore        4
     997: iconst_0
     998: istore        5
    1000: aload         4
    1002: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1007: astore        6
    1009: aload         6
    1011: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1016: ifne          1027
    1019: new           #72                 // class java/util/NoSuchElementException
    1022: dup
    1023: invokespecial #73                 // Method java/util/NoSuchElementException."<init>":()V
    1026: athrow
    1027: aload         6
    1029: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1034: astore        7
    1036: aload         6
    1038: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1043: ifne          1051
    1046: aload         7
    1048: goto          1124
    1051: aload         7
    1053: checkcast     #120                // class yitian/study/skilled/Product
    1056: astore        8
    1058: iconst_0
    1059: istore        10
    1061: aload         8
    1063: invokevirtual #124                // Method yitian/study/skilled/Product.getPrice:()D
    1066: dstore        8
    1068: aload         6
    1070: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1075: astore        10
    1077: aload         10
    1079: checkcast     #120                // class yitian/study/skilled/Product
    1082: astore        11
    1084: iconst_0
    1085: istore        13
    1087: aload         11
    1089: invokevirtual #124                // Method yitian/study/skilled/Product.getPrice:()D
    1092: dstore        11
    1094: dload         8
    1096: dload         11
    1098: invokestatic  #130                // Method java/lang/Double.compare:(DD)I
    1101: ifge          1112
    1104: aload         10
    1106: astore        7
    1108: dload         11
    1110: dstore        8
    1112: aload         6
    1114: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1119: ifne          1068
    1122: aload         7
    1124: checkcast     #120                // class yitian/study/skilled/Product
    1127: astore_3
    1128: new           #89                 // class java/lang/StringBuilder
    1131: dup
    1132: invokespecial #90                 // Method java/lang/StringBuilder."<init>":()V
    1135: ldc           #137                // String 价格最贵的商品:
    1137: invokevirtual #96                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1140: aload_3
    1141: invokevirtual #99                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    1144: invokevirtual #103                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    1147: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
    1150: swap
    1151: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1154: invokestatic  #135                // Method products:()Ljava/util/List;
    1157: checkcast     #21                 // class java/lang/Iterable
    1160: astore        5
    1162: iconst_0
    1163: istore        6
    1165: aload         5
    1167: astore        7
    1169: new           #55                 // class java/util/ArrayList
    1172: dup
    1173: invokespecial #56                 // Method java/util/ArrayList."<init>":()V
    1176: checkcast     #139                // class java/util/Collection
    1179: astore        8
    1181: iconst_0
    1182: istore        10
    1184: aload         7
    1186: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1191: astore        11
    1193: aload         11
    1195: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1200: ifeq          1254
    1203: aload         11
    1205: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1210: astore        13
    1212: aload         13
    1214: checkcast     #120                // class yitian/study/skilled/Product
    1217: astore        14
    1219: iconst_0
    1220: istore        15
    1222: aload         14
    1224: invokevirtual #143                // Method yitian/study/skilled/Product.getCategory:()Lyitian/study/skilled/Category;
    1227: getstatic     #149                // Field yitian/study/skilled/Category.Computer:Lyitian/study/skilled/Category;
    1230: if_acmpne     1237
    1233: iconst_1
    1234: goto          1238
    1237: iconst_0
    1238: ifeq          1193
    1241: aload         8
    1243: aload         13
    1245: invokeinterface #150,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1250: pop
    1251: goto          1193
    1254: aload         8
    1256: checkcast     #58                 // class java/util/List
    1259: nop
    1260: astore        4
    1262: new           #89                 // class java/lang/StringBuilder
    1265: dup
    1266: invokespecial #90                 // Method java/lang/StringBuilder."<init>":()V
    1269: ldc           #152                // String 计算机类的所有商品:
    1271: invokevirtual #96                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1274: aload         4
    1276: invokevirtual #99                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    1279: invokevirtual #103                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    1282: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
    1285: swap
    1286: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1289: invokestatic  #135                // Method products:()Ljava/util/List;
    1292: checkcast     #21                 // class java/lang/Iterable
    1295: astore        6
    1297: iconst_0
    1298: istore        7
    1300: aload         6
    1302: new           #154                // class yitian/study/skilled/CollectionsKt$main$$inlined$sortedBy$1
    1305: dup
    1306: invokespecial #155                // Method yitian/study/skilled/CollectionsKt$main$$inlined$sortedBy$1."<init>":()V
    1309: checkcast     #157                // class java/util/Comparator
    1312: invokestatic  #163                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
    1315: checkcast     #21                 // class java/lang/Iterable
    1318: astore        6
    1320: nop
    1321: iconst_0
    1322: istore        7
    1324: aload         6
    1326: astore        8
    1328: new           #55                 // class java/util/ArrayList
    1331: dup
    1332: invokespecial #56                 // Method java/util/ArrayList."<init>":()V
    1335: checkcast     #139                // class java/util/Collection
    1338: astore        10
    1340: iconst_0
    1341: istore        11
    1343: aload         8
    1345: astore        13
    1347: iconst_0
    1348: istore        14
    1350: iconst_0
    1351: istore        15
    1353: aload         13
    1355: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1360: astore        16
    1362: aload         16
    1364: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1369: ifeq          1449
    1372: aload         16
    1374: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1379: astore        17
    1381: iload         15
    1383: iinc          15, 1
    1386: istore        18
    1388: iload         18
    1390: ifge          1396
    1393: invokestatic  #166                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
    1396: iload         18
    1398: aload         17
    1400: astore        19
    1402: istore        20
    1404: iconst_0
    1405: istore        21
    1407: iload         20
    1409: aload         19
    1411: checkcast     #120                // class yitian/study/skilled/Product
    1414: pop
    1415: istore        23
    1417: iconst_0
    1418: istore        24
    1420: iload         23
    1422: iconst_3
    1423: if_icmpge     1430
    1426: iconst_1
    1427: goto          1431
    1430: iconst_0
    1431: ifeq          1444
    1434: aload         10
    1436: aload         19
    1438: invokeinterface #150,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1443: pop
    1444: nop
    1445: nop
    1446: goto          1362
    1449: nop
    1450: aload         10
    1452: checkcast     #58                 // class java/util/List
    1455: nop
    1456: astore        5
    1458: new           #89                 // class java/lang/StringBuilder
    1461: dup
    1462: invokespecial #90                 // Method java/lang/StringBuilder."<init>":()V
    1465: ldc           #168                // String 最便宜的三件商品:
    1467: invokevirtual #96                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1470: aload         5
    1472: invokevirtual #99                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    1475: invokevirtual #103                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    1478: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
    1481: swap
    1482: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1485: invokestatic  #19                 // Method orders:()Ljava/util/List;
    1488: checkcast     #21                 // class java/lang/Iterable
    1491: astore        7
    1493: iconst_0
    1494: istore        8
    1496: aload         7
    1498: astore        10
    1500: new           #23                 // class java/util/LinkedHashMap
    1503: dup
    1504: invokespecial #27                 // Method java/util/LinkedHashMap."<init>":()V
    1507: checkcast     #29                 // class java/util/Map
    1510: astore        11
    1512: iconst_0
    1513: istore        13
    1515: aload         10
    1517: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1522: astore        14
    1524: aload         14
    1526: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1531: ifeq          1636
    1534: aload         14
    1536: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1541: astore        15
    1543: aload         15
    1545: checkcast     #45                 // class yitian/study/skilled/Order
    1548: astore        16
    1550: iconst_0
    1551: istore        17
    1553: aload         16
    1555: invokevirtual #49                 // Method yitian/study/skilled/Order.getCustomer:()Lyitian/study/skilled/Customer;
    1558: astore        18
    1560: aload         11
    1562: astore        19
    1564: iconst_0
    1565: istore        20
    1567: aload         19
    1569: aload         18
    1571: invokeinterface #53,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1576: astore        21
    1578: aload         21
    1580: ifnonnull     1615
    1583: iconst_0
    1584: istore        22
    1586: new           #55                 // class java/util/ArrayList
    1589: dup
    1590: invokespecial #56                 // Method java/util/ArrayList."<init>":()V
    1593: checkcast     #58                 // class java/util/List
    1596: astore        22
    1598: aload         19
    1600: aload         18
    1602: aload         22
    1604: invokeinterface #62,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1609: pop
    1610: aload         22
    1612: goto          1617
    1615: aload         21
    1617: nop
    1618: checkcast     #58                 // class java/util/List
    1621: astore        16
    1623: aload         16
    1625: aload         15
    1627: invokeinterface #66,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
    1632: pop
    1633: goto          1524
    1636: aload         11
    1638: nop
    1639: astore        7
    1641: nop
    1642: iconst_0
    1643: istore        8
    1645: aload         7
    1647: astore        10
    1649: new           #55                 // class java/util/ArrayList
    1652: dup
    1653: aload         7
    1655: invokeinterface #169,  1          // InterfaceMethod java/util/Map.size:()I
    1660: invokespecial #172                // Method java/util/ArrayList."<init>":(I)V
    1663: checkcast     #139                // class java/util/Collection
    1666: astore        11
    1668: iconst_0
    1669: istore        13
    1671: aload         10
    1673: invokeinterface #70,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
    1678: invokeinterface #175,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
    1683: astore        14
    1685: aload         14
    1687: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1692: ifeq          1842
    1695: aload         14
    1697: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1702: checkcast     #75                 // class java/util/Map$Entry
    1705: astore        15
    1707: aload         11
    1709: aload         15
    1711: astore        16
    1713: astore        56
    1715: iconst_0
    1716: istore        17
    1718: aload         16
    1720: invokeinterface #78,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
    1725: checkcast     #21                 // class java/lang/Iterable
    1728: astore        18
    1730: iconst_0
    1731: istore        19
    1733: aload         18
    1735: astore        20
    1737: new           #55                 // class java/util/ArrayList
    1740: dup
    1741: aload         18
    1743: bipush        10
    1745: invokestatic  #179                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    1748: invokespecial #172                // Method java/util/ArrayList."<init>":(I)V
    1751: checkcast     #139                // class java/util/Collection
    1754: astore        21
    1756: iconst_0
    1757: istore        22
    1759: aload         20
    1761: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1766: astore        23
    1768: aload         23
    1770: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1775: ifeq          1818
    1778: aload         23
    1780: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1785: astore        24
    1787: aload         21
    1789: aload         24
    1791: checkcast     #45                 // class yitian/study/skilled/Order
    1794: astore        25
    1796: astore        26
    1798: iconst_0
    1799: istore        27
    1801: aload         25
    1803: invokevirtual #118                // Method yitian/study/skilled/Order.getProducts:()Ljava/util/List;
    1806: aload         26
    1808: swap
    1809: invokeinterface #150,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1814: pop
    1815: goto          1768
    1818: aload         21
    1820: checkcast     #58                 // class java/util/List
    1823: nop
    1824: checkcast     #21                 // class java/lang/Iterable
    1827: invokestatic  #183                // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;
    1830: aload         56
    1832: swap
    1833: invokeinterface #150,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1838: pop
    1839: goto          1685
    1842: aload         11
    1844: checkcast     #58                 // class java/util/List
    1847: nop
    1848: astore        6
    1850: aload         6
    1852: checkcast     #21                 // class java/lang/Iterable
    1855: astore        8
    1857: invokestatic  #135                // Method products:()Ljava/util/List;
    1860: astore        10
    1862: iconst_0
    1863: istore        11
    1865: aload         10
    1867: astore        13
    1869: aload         8
    1871: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1876: astore        14
    1878: aload         14
    1880: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1885: ifeq          1935
    1888: aload         14
    1890: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1895: astore        15
    1897: aload         13
    1899: aload         15
    1901: checkcast     #58                 // class java/util/List
    1904: astore        16
    1906: astore        17
    1908: iconst_0
    1909: istore        18
    1911: aload         17
    1913: checkcast     #21                 // class java/lang/Iterable
    1916: aload         16
    1918: checkcast     #21                 // class java/lang/Iterable
    1921: invokestatic  #187                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
    1924: checkcast     #21                 // class java/lang/Iterable
    1927: invokestatic  #190                // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;
    1930: astore        13
    1932: goto          1878
    1935: aload         13
    1937: astore        7
    1939: new           #89                 // class java/lang/StringBuilder
    1942: dup
    1943: invokespecial #90                 // Method java/lang/StringBuilder."<init>":()V
    1946: ldc           #192                // String 每位顾客都购买了的商品:
    1948: invokevirtual #96                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1951: aload         7
    1953: invokevirtual #99                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    1956: invokevirtual #103                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    1959: getstatic     #109                // Field java/lang/System.out:Ljava/io/PrintStream;
    1962: swap
    1963: invokevirtual #115                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1966: return

  public static final java.util.List<yitian.study.skilled.City> cities();
    Code:
       0: iconst_5
       1: anewarray     #282                // class yitian/study/skilled/City
       4: astore_0
       5: aload_0
       6: iconst_0
       7: new           #282                // class yitian/study/skilled/City
      10: dup
      11: ldc_w         #284                // String 呼和浩特
      14: invokespecial #287                // Method yitian/study/skilled/City."<init>":(Ljava/lang/String;)V
      17: aastore
      18: aload_0
      19: iconst_1
      20: new           #282                // class yitian/study/skilled/City
      23: dup
      24: ldc_w         #289                // String 北京
      27: invokespecial #287                // Method yitian/study/skilled/City."<init>":(Ljava/lang/String;)V
      30: aastore
      31: aload_0
      32: iconst_2
      33: new           #282                // class yitian/study/skilled/City
      36: dup
      37: ldc_w         #291                // String 上海
      40: invokespecial #287                // Method yitian/study/skilled/City."<init>":(Ljava/lang/String;)V
      43: aastore
      44: aload_0
      45: iconst_3
      46: new           #282                // class yitian/study/skilled/City
      49: dup
      50: ldc_w         #293                // String 天津
      53: invokespecial #287                // Method yitian/study/skilled/City."<init>":(Ljava/lang/String;)V
      56: aastore
      57: aload_0
      58: iconst_4
      59: new           #282                // class yitian/study/skilled/City
      62: dup
      63: ldc_w         #295                // String 武汉
      66: invokespecial #287                // Method yitian/study/skilled/City."<init>":(Ljava/lang/String;)V
      69: aastore
      70: aload_0
      71: invokestatic  #299                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      74: areturn

  public static final java.util.List<yitian.study.skilled.Product> products();
    Code:
       0: bipush        6
       2: anewarray     #120                // class yitian/study/skilled/Product
       5: astore_0
       6: aload_0
       7: iconst_0
       8: new           #120                // class yitian/study/skilled/Product
      11: dup
      12: ldc_w         #302                // String Intel Core i7-7700k
      15: ldc2_w        #303                // double 2799.0d
      18: getstatic     #149                // Field yitian/study/skilled/Category.Computer:Lyitian/study/skilled/Category;
      21: invokespecial #307                // Method yitian/study/skilled/Product."<init>":(Ljava/lang/String;DLyitian/study/skilled/Category;)V
      24: aastore
      25: aload_0
      26: iconst_1
      27: new           #120                // class yitian/study/skilled/Product
      30: dup
      31: ldc_w         #309                // String AMD Ryzen 7 1700
      34: ldc2_w        #310                // double 2499.0d
      37: getstatic     #149                // Field yitian/study/skilled/Category.Computer:Lyitian/study/skilled/Category;
      40: invokespecial #307                // Method yitian/study/skilled/Product."<init>":(Ljava/lang/String;DLyitian/study/skilled/Category;)V
      43: aastore
      44: aload_0
      45: iconst_2
      46: new           #120                // class yitian/study/skilled/Product
      49: dup
      50: ldc_w         #313                // String Counter Strike
      53: ldc2_w        #314                // double 10.0d
      56: getstatic     #318                // Field yitian/study/skilled/Category.Game:Lyitian/study/skilled/Category;
      59: invokespecial #307                // Method yitian/study/skilled/Product."<init>":(Ljava/lang/String;DLyitian/study/skilled/Category;)V
      62: aastore
      63: aload_0
      64: iconst_3
      65: new           #120                // class yitian/study/skilled/Product
      68: dup
      69: ldc_w         #320                // String Batman
      72: ldc2_w        #321                // double 79.0d
      75: getstatic     #318                // Field yitian/study/skilled/Category.Game:Lyitian/study/skilled/Category;
      78: invokespecial #307                // Method yitian/study/skilled/Product."<init>":(Ljava/lang/String;DLyitian/study/skilled/Category;)V
      81: aastore
      82: aload_0
      83: iconst_4
      84: new           #120                // class yitian/study/skilled/Product
      87: dup
      88: ldc_w         #324                // String Thinking in Java
      91: ldc2_w        #325                // double 59.0d
      94: getstatic     #329                // Field yitian/study/skilled/Category.Education:Lyitian/study/skilled/Category;
      97: invokespecial #307                // Method yitian/study/skilled/Product."<init>":(Ljava/lang/String;DLyitian/study/skilled/Category;)V
     100: aastore
     101: aload_0
     102: iconst_5
     103: new           #120                // class yitian/study/skilled/Product
     106: dup
     107: ldc_w         #331                // String C# Programming
     110: ldc2_w        #332                // double 99.0d
     113: getstatic     #329                // Field yitian/study/skilled/Category.Education:Lyitian/study/skilled/Category;
     116: invokespecial #307                // Method yitian/study/skilled/Product."<init>":(Ljava/lang/String;DLyitian/study/skilled/Category;)V
     119: aastore
     120: aload_0
     121: invokestatic  #299                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     124: areturn

  public static final java.util.List<yitian.study.skilled.Customer> customers();
    Code:
       0: iconst_5
       1: anewarray     #87                 // class yitian/study/skilled/Customer
       4: astore_0
       5: aload_0
       6: iconst_0
       7: new           #87                 // class yitian/study/skilled/Customer
      10: dup
      11: ldc_w         #337                // String 易天
      14: invokestatic  #339                // Method cities:()Ljava/util/List;
      17: iconst_0
      18: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      23: checkcast     #282                // class yitian/study/skilled/City
      26: invokespecial #345                // Method yitian/study/skilled/Customer."<init>":(Ljava/lang/String;Lyitian/study/skilled/City;)V
      29: aastore
      30: aload_0
      31: iconst_1
      32: new           #87                 // class yitian/study/skilled/Customer
      35: dup
      36: ldc_w         #347                // String 张三
      39: invokestatic  #339                // Method cities:()Ljava/util/List;
      42: iconst_1
      43: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      48: checkcast     #282                // class yitian/study/skilled/City
      51: invokespecial #345                // Method yitian/study/skilled/Customer."<init>":(Ljava/lang/String;Lyitian/study/skilled/City;)V
      54: aastore
      55: aload_0
      56: iconst_2
      57: new           #87                 // class yitian/study/skilled/Customer
      60: dup
      61: ldc_w         #349                // String 李四
      64: invokestatic  #339                // Method cities:()Ljava/util/List;
      67: iconst_2
      68: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      73: checkcast     #282                // class yitian/study/skilled/City
      76: invokespecial #345                // Method yitian/study/skilled/Customer."<init>":(Ljava/lang/String;Lyitian/study/skilled/City;)V
      79: aastore
      80: aload_0
      81: iconst_3
      82: new           #87                 // class yitian/study/skilled/Customer
      85: dup
      86: ldc_w         #351                // String 沪生
      89: invokestatic  #339                // Method cities:()Ljava/util/List;
      92: iconst_3
      93: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      98: checkcast     #282                // class yitian/study/skilled/City
     101: invokespecial #345                // Method yitian/study/skilled/Customer."<init>":(Ljava/lang/String;Lyitian/study/skilled/City;)V
     104: aastore
     105: aload_0
     106: iconst_4
     107: new           #87                 // class yitian/study/skilled/Customer
     110: dup
     111: ldc_w         #353                // String 王五
     114: invokestatic  #339                // Method cities:()Ljava/util/List;
     117: iconst_4
     118: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     123: checkcast     #282                // class yitian/study/skilled/City
     126: invokespecial #345                // Method yitian/study/skilled/Customer."<init>":(Ljava/lang/String;Lyitian/study/skilled/City;)V
     129: aastore
     130: aload_0
     131: invokestatic  #299                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     134: areturn

  public static final java.util.List<yitian.study.skilled.Order> orders();
    Code:
       0: bipush        6
       2: anewarray     #45                 // class yitian/study/skilled/Order
       5: astore_0
       6: aload_0
       7: iconst_0
       8: new           #45                 // class yitian/study/skilled/Order
      11: dup
      12: invokestatic  #135                // Method products:()Ljava/util/List;
      15: iconst_0
      16: iconst_3
      17: invokeinterface #358,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
      22: invokestatic  #360                // Method customers:()Ljava/util/List;
      25: iconst_0
      26: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      31: checkcast     #87                 // class yitian/study/skilled/Customer
      34: invokespecial #363                // Method yitian/study/skilled/Order."<init>":(Ljava/util/List;Lyitian/study/skilled/Customer;)V
      37: aastore
      38: aload_0
      39: iconst_1
      40: new           #45                 // class yitian/study/skilled/Order
      43: dup
      44: invokestatic  #135                // Method products:()Ljava/util/List;
      47: iconst_3
      48: invokestatic  #135                // Method products:()Ljava/util/List;
      51: invokeinterface #82,  1           // InterfaceMethod java/util/List.size:()I
      56: invokeinterface #358,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
      61: invokestatic  #360                // Method customers:()Ljava/util/List;
      64: iconst_0
      65: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      70: checkcast     #87                 // class yitian/study/skilled/Customer
      73: invokespecial #363                // Method yitian/study/skilled/Order."<init>":(Ljava/util/List;Lyitian/study/skilled/Customer;)V
      76: aastore
      77: aload_0
      78: iconst_2
      79: new           #45                 // class yitian/study/skilled/Order
      82: dup
      83: invokestatic  #135                // Method products:()Ljava/util/List;
      86: iconst_1
      87: iconst_3
      88: invokeinterface #358,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
      93: invokestatic  #360                // Method customers:()Ljava/util/List;
      96: iconst_1
      97: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     102: checkcast     #87                 // class yitian/study/skilled/Customer
     105: invokespecial #363                // Method yitian/study/skilled/Order."<init>":(Ljava/util/List;Lyitian/study/skilled/Customer;)V
     108: aastore
     109: aload_0
     110: iconst_3
     111: new           #45                 // class yitian/study/skilled/Order
     114: dup
     115: invokestatic  #135                // Method products:()Ljava/util/List;
     118: iconst_2
     119: iconst_4
     120: invokeinterface #358,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     125: invokestatic  #360                // Method customers:()Ljava/util/List;
     128: iconst_2
     129: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     134: checkcast     #87                 // class yitian/study/skilled/Customer
     137: invokespecial #363                // Method yitian/study/skilled/Order."<init>":(Ljava/util/List;Lyitian/study/skilled/Customer;)V
     140: aastore
     141: aload_0
     142: iconst_4
     143: new           #45                 // class yitian/study/skilled/Order
     146: dup
     147: invokestatic  #135                // Method products:()Ljava/util/List;
     150: iconst_0
     151: iconst_4
     152: invokeinterface #358,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     157: invokestatic  #360                // Method customers:()Ljava/util/List;
     160: iconst_3
     161: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     166: checkcast     #87                 // class yitian/study/skilled/Customer
     169: invokespecial #363                // Method yitian/study/skilled/Order."<init>":(Ljava/util/List;Lyitian/study/skilled/Customer;)V
     172: aastore
     173: aload_0
     174: iconst_5
     175: new           #45                 // class yitian/study/skilled/Order
     178: dup
     179: invokestatic  #135                // Method products:()Ljava/util/List;
     182: iconst_1
     183: iconst_5
     184: invokeinterface #358,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     189: invokestatic  #360                // Method customers:()Ljava/util/List;
     192: iconst_4
     193: invokeinterface #342,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     198: checkcast     #87                 // class yitian/study/skilled/Customer
     201: invokespecial #363                // Method yitian/study/skilled/Order."<init>":(Ljava/util/List;Lyitian/study/skilled/Customer;)V
     204: aastore
     205: aload_0
     206: invokestatic  #299                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     209: areturn
}


package com.includehelp.basic

import java.util.*
   /* fun main(args: Array<String>) {

        val num = 10
        var i = 1
        var factorial: Long = 1
        while (i <= num) {
            factorial *= i.toLong()
            i++
        }
        println(" El Factorial de $num = $factorial")
    }*/
// Kotlin program for
// Print all permutations of a string
class Permutation
{
    // Swapping two string elements by index
    fun swap(
        info: String,
        size: Int,
        a: Int,
        b: Int
    ): String
    {
        var text = info;
        // Check valid location of swap element
        if ((a >= 0 && a < size) && (b >= 0 && b < size))
        {
            // Get first character
            val first: Char = text.get(a);
            // Get second character
            val second: Char = text.get(b);
            // Put character
            text = text.substring(0, b) + first.toString() +
                    text.substring(b + 1);
            text = text.substring(0, a) + second.toString() +
                    text.substring(a + 1);
        }
        return text;
    }

    // Method which is print all permutations of given string
    fun findPermutation(info: String, n: Int, size: Int): Unit
    {
        if (n > size)
        {
            return;
        }
        if (n == size)
        {
            println(info);
            return;
        }
        var text = info;
        var i: Int = n;
        while (i < size)
        {
            // Swap the element
            text = this.swap(text, size, i, n);
            this.findPermutation(text, n + 1, size);
            // Swap the element
            text = this.swap(text, size, i, n);
            i += 1;
        }
    }
}
fun main(args: Array < String > ): Unit
{
    val task: Permutation = Permutation();
    var text: String = "CARACOL";
    var size: Int = text.length;
    task.findPermutation(text, 0, size);
    println("");
    text = "caracol";
    size = text.length;
    task.findPermutation(text, 0, size);
}

Compiled from "Main.kt"
public final class com.includehelp.basic.MainKt {
  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #9                  // String args
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #17                 // class com/includehelp/basic/Permutation
       9: dup
      10: invokespecial #21                 // Method com/includehelp/basic/Permutation."<init>":()V
      13: astore_1
      14: ldc           #23                 // String CARACOL
      16: astore_2
      17: aload_2
      18: invokevirtual #29                 // Method java/lang/String.length:()I
      21: istore_3
      22: aload_1
      23: aload_2
      24: iconst_0
      25: iload_3
      26: invokevirtual #33                 // Method com/includehelp/basic/Permutation.findPermutation:(Ljava/lang/String;II)V
      29: ldc           #35                 // String
      31: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
      34: swap
      35: invokevirtual #47                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      38: ldc           #49                 // String caracol
      40: astore_2
      41: aload_2
      42: invokevirtual #29                 // Method java/lang/String.length:()I
      45: istore_3
      46: aload_1
      47: aload_2
      48: iconst_0
      49: iload_3
      50: invokevirtual #33                 // Method com/includehelp/basic/Permutation.findPermutation:(Ljava/lang/String;II)V
      53: return
}


package io.github.zebalu.advent2020

typealias  Rules = Map<String, Set<Pair<Int, String>>>

object BagRuleReader {

	fun readRules(lines: List<String>): Rules {
		val result = mutableMapOf<String, MutableSet<Pair<Int, String>>>()
		lines.forEach { line ->
			val parts = line.split(" bags contain ")
			val type = parts[0]
			parts[1].split(", ").map { s -> s.split(" bag")[0] }.forEach { bag ->
				val split = bag.split(" ")
				if (split.size != 2 && split.size != 3) {
					throw IllegalStateException("split is not 2 or 3 long: " + split)
				}
				val count = if ("no".equals(split[0])) 0 else split[0].toInt()
				val bagName = if (count == 0) "no other" else split[1] + " " + split[2]
				result.computeIfAbsent(type, { _ -> mutableSetOf<Pair<Int, String>>() }).add(Pair(count, bagName))
			}
		}
		return result
	}

	fun countWaysToShinyGold(rules: Map<String, Set<Pair<Int, String>>>) =
		rules.keys.count { name ->
			(!("shiny gold".equals(name))) && isThereWayToShinyGold(
				name,
				rules,
				setOf(name)
			)
		}

	fun countContentInShinyGold(rules: Rules) = countContent("shiny gold", rules)

	private fun countContent(name: String, rules: Rules): Int {
		return rules.get(name)?.map { pair ->
			pair.first + pair.first * countContent(pair.second, rules)
		}?.sum() ?: 0
	}

	private fun isThereWayToShinyGold(name: String, rules: Rules, visited: Set<String>): Boolean {
		if ("shiny gold".equals(name)) {
			return true
		}
		val col = rules.get(name)?.map { pair ->
			if (pair.first == 0) false
			else if ("shiny gold".equals(pair.second)) true
			else if (visited.contains(pair.second)) false
			else isThereWayToShinyGold(
				pair.second,
				rules,
				visited + pair.second
			)
		}
		return if (col == null || col.isEmpty()) false else col.reduce { acc, next -> acc || next }
	}
}

Compiled from "BagRuleReader.kt"
public final class io.github.zebalu.advent2020.BagRuleReader {
  public static final io.github.zebalu.advent2020.BagRuleReader INSTANCE;

  private io.github.zebalu.advent2020.BagRuleReader();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.util.Map<java.lang.String, java.util.Set<kotlin.Pair<java.lang.Integer, java.lang.String>>> readRules(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String lines
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #24                 // class java/util/LinkedHashMap
       9: dup
      10: invokespecial #25                 // Method java/util/LinkedHashMap."<init>":()V
      13: checkcast     #27                 // class java/util/Map
      16: astore_2
      17: aload_1
      18: checkcast     #29                 // class java/lang/Iterable
      21: astore_3
      22: iconst_0
      23: istore        4
      25: aload_3
      26: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      31: astore        5
      33: aload         5
      35: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      40: ifeq          536
      43: aload         5
      45: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      50: astore        6
      52: aload         6
      54: checkcast     #45                 // class java/lang/String
      57: astore        7
      59: iconst_0
      60: istore        8
      62: aload         7
      64: checkcast     #47                 // class java/lang/CharSequence
      67: iconst_1
      68: anewarray     #45                 // class java/lang/String
      71: astore        9
      73: aload         9
      75: iconst_0
      76: ldc           #49                 // String  bags contain
      78: aastore
      79: aload         9
      81: iconst_0
      82: iconst_0
      83: bipush        6
      85: aconst_null
      86: invokestatic  #55                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      89: astore        10
      91: aload         10
      93: iconst_0
      94: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      99: checkcast     #45                 // class java/lang/String
     102: astore        9
     104: aload         10
     106: iconst_1
     107: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     112: checkcast     #47                 // class java/lang/CharSequence
     115: iconst_1
     116: anewarray     #45                 // class java/lang/String
     119: astore        11
     121: aload         11
     123: iconst_0
     124: ldc           #63                 // String ,
     126: aastore
     127: aload         11
     129: iconst_0
     130: iconst_0
     131: bipush        6
     133: aconst_null
     134: invokestatic  #55                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     137: checkcast     #29                 // class java/lang/Iterable
     140: astore        11
     142: iconst_0
     143: istore        12
     145: aload         11
     147: astore        13
     149: new           #65                 // class java/util/ArrayList
     152: dup
     153: aload         11
     155: bipush        10
     157: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     160: invokespecial #74                 // Method java/util/ArrayList."<init>":(I)V
     163: checkcast     #76                 // class java/util/Collection
     166: astore        14
     168: iconst_0
     169: istore        15
     171: aload         13
     173: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     178: astore        16
     180: aload         16
     182: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     187: ifeq          261
     190: aload         16
     192: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     197: astore        17
     199: aload         14
     201: aload         17
     203: checkcast     #45                 // class java/lang/String
     206: astore        18
     208: astore        19
     210: iconst_0
     211: istore        20
     213: aload         18
     215: checkcast     #47                 // class java/lang/CharSequence
     218: iconst_1
     219: anewarray     #45                 // class java/lang/String
     222: astore        21
     224: aload         21
     226: iconst_0
     227: ldc           #78                 // String  bag
     229: aastore
     230: aload         21
     232: iconst_0
     233: iconst_0
     234: bipush        6
     236: aconst_null
     237: invokestatic  #55                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     240: iconst_0
     241: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     246: checkcast     #45                 // class java/lang/String
     249: aload         19
     251: swap
     252: invokeinterface #82,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     257: pop
     258: goto          180
     261: aload         14
     263: checkcast     #57                 // class java/util/List
     266: nop
     267: checkcast     #29                 // class java/lang/Iterable
     270: astore        11
     272: nop
     273: iconst_0
     274: istore        12
     276: aload         11
     278: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     283: astore        13
     285: aload         13
     287: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     292: ifeq          530
     295: aload         13
     297: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     302: astore        14
     304: aload         14
     306: checkcast     #45                 // class java/lang/String
     309: astore        15
     311: iconst_0
     312: istore        16
     314: aload         15
     316: checkcast     #47                 // class java/lang/CharSequence
     319: iconst_1
     320: anewarray     #45                 // class java/lang/String
     323: astore        17
     325: aload         17
     327: iconst_0
     328: ldc           #84                 // String
     330: aastore
     331: aload         17
     333: iconst_0
     334: iconst_0
     335: bipush        6
     337: aconst_null
     338: invokestatic  #55                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     341: astore        18
     343: aload         18
     345: invokeinterface #88,  1           // InterfaceMethod java/util/List.size:()I
     350: iconst_2
     351: if_icmpeq     393
     354: aload         18
     356: invokeinterface #88,  1           // InterfaceMethod java/util/List.size:()I
     361: iconst_3
     362: if_icmpeq     393
     365: new           #90                 // class java/lang/IllegalStateException
     368: dup
     369: new           #92                 // class java/lang/StringBuilder
     372: dup
     373: invokespecial #93                 // Method java/lang/StringBuilder."<init>":()V
     376: ldc           #95                 // String split is not 2 or 3 long:
     378: invokevirtual #99                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     381: aload         18
     383: invokevirtual #102                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     386: invokevirtual #106                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     389: invokespecial #109                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     392: athrow
     393: ldc           #111                // String no
     395: aload         18
     397: iconst_0
     398: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     403: invokevirtual #114                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     406: ifeq          413
     409: iconst_0
     410: goto          427
     413: aload         18
     415: iconst_0
     416: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     421: checkcast     #45                 // class java/lang/String
     424: invokestatic  #120                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     427: istore        17
     429: iload         17
     431: ifne          439
     434: ldc           #122                // String no other
     436: goto          482
     439: new           #92                 // class java/lang/StringBuilder
     442: dup
     443: invokespecial #93                 // Method java/lang/StringBuilder."<init>":()V
     446: aload         18
     448: iconst_1
     449: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     454: checkcast     #45                 // class java/lang/String
     457: invokevirtual #99                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     460: bipush        32
     462: invokevirtual #125                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     465: aload         18
     467: iconst_2
     468: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     473: checkcast     #45                 // class java/lang/String
     476: invokevirtual #99                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     479: invokevirtual #106                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     482: astore        20
     484: aload_2
     485: aload         9
     487: invokedynamic #144,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
     492: invokedynamic #155,  0            // InvokeDynamic #1:apply:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Function;
     497: invokeinterface #159,  3          // InterfaceMethod java/util/Map.computeIfAbsent:(Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object;
     502: checkcast     #161                // class java/util/Set
     505: new           #163                // class kotlin/Pair
     508: dup
     509: iload         17
     511: invokestatic  #167                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     514: aload         20
     516: invokespecial #170                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     519: invokeinterface #171,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     524: pop
     525: nop
     526: nop
     527: goto          285
     530: nop
     531: nop
     532: nop
     533: goto          33
     536: nop
     537: aload_2
     538: areturn

  public final int countWaysToShinyGold(java.util.Map<java.lang.String, ? extends java.util.Set<kotlin.Pair<java.lang.Integer, java.lang.String>>>);
    Code:
       0: aload_1
       1: ldc           #206                // String rules
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokeinterface #210,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
      12: checkcast     #29                 // class java/lang/Iterable
      15: astore_2
      16: iconst_0
      17: istore_3
      18: aload_2
      19: instanceof    #76                 // class java/util/Collection
      22: ifeq          41
      25: aload_2
      26: checkcast     #76                 // class java/util/Collection
      29: invokeinterface #213,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      34: ifeq          41
      37: iconst_0
      38: goto          133
      41: iconst_0
      42: istore        4
      44: aload_2
      45: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        5
      52: aload         5
      54: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          131
      62: aload         5
      64: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: astore        6
      71: aload         6
      73: checkcast     #45                 // class java/lang/String
      76: astore        7
      78: iconst_0
      79: istore        8
      81: ldc           #215                // String shiny gold
      83: aload         7
      85: invokevirtual #114                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      88: ifne          112
      91: getstatic     #218                // Field INSTANCE:Lio/github/zebalu/advent2020/BagRuleReader;
      94: aload         7
      96: aload_1
      97: aload         7
      99: invokestatic  #223                // Method kotlin/collections/SetsKt.setOf:(Ljava/lang/Object;)Ljava/util/Set;
     102: invokespecial #227                // Method isThereWayToShinyGold:(Ljava/lang/String;Ljava/util/Map;Ljava/util/Set;)Z
     105: ifeq          112
     108: iconst_1
     109: goto          113
     112: iconst_0
     113: nop
     114: ifeq          52
     117: iinc          4, 1
     120: iload         4
     122: ifge          52
     125: invokestatic  #230                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     128: goto          52
     131: iload         4
     133: ireturn

  public final int countContentInShinyGold(java.util.Map<java.lang.String, ? extends java.util.Set<kotlin.Pair<java.lang.Integer, java.lang.String>>>);
    Code:
       0: aload_1
       1: ldc           #206                // String rules
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: ldc           #215                // String shiny gold
       9: aload_1
      10: invokespecial #240                // Method countContent:(Ljava/lang/String;Ljava/util/Map;)I
      13: ireturn

  private final int countContent(java.lang.String, java.util.Map<java.lang.String, ? extends java.util.Set<kotlin.Pair<java.lang.Integer, java.lang.String>>>);
    Code:
       0: aload_2
       1: aload_1
       2: invokeinterface #243,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #161                // class java/util/Set
      10: dup
      11: ifnull        156
      14: checkcast     #29                 // class java/lang/Iterable
      17: astore_3
      18: iconst_0
      19: istore        4
      21: aload_3
      22: astore        5
      24: new           #65                 // class java/util/ArrayList
      27: dup
      28: aload_3
      29: bipush        10
      31: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      34: invokespecial #74                 // Method java/util/ArrayList."<init>":(I)V
      37: checkcast     #76                 // class java/util/Collection
      40: astore        6
      42: iconst_0
      43: istore        7
      45: aload         5
      47: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      52: astore        8
      54: aload         8
      56: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      61: ifeq          141
      64: aload         8
      66: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      71: astore        9
      73: aload         6
      75: aload         9
      77: checkcast     #163                // class kotlin/Pair
      80: astore        10
      82: astore        12
      84: iconst_0
      85: istore        11
      87: aload         10
      89: invokevirtual #246                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      92: checkcast     #248                // class java/lang/Number
      95: invokevirtual #251                // Method java/lang/Number.intValue:()I
      98: aload         10
     100: invokevirtual #246                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     103: checkcast     #248                // class java/lang/Number
     106: invokevirtual #251                // Method java/lang/Number.intValue:()I
     109: getstatic     #218                // Field INSTANCE:Lio/github/zebalu/advent2020/BagRuleReader;
     112: aload         10
     114: invokevirtual #254                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     117: checkcast     #45                 // class java/lang/String
     120: aload_2
     121: invokespecial #240                // Method countContent:(Ljava/lang/String;Ljava/util/Map;)I
     124: imul
     125: iadd
     126: invokestatic  #167                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     129: aload         12
     131: swap
     132: invokeinterface #82,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     137: pop
     138: goto          54
     141: aload         6
     143: checkcast     #57                 // class java/util/List
     146: nop
     147: checkcast     #29                 // class java/lang/Iterable
     150: invokestatic  #258                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     153: goto          158
     156: pop
     157: iconst_0
     158: ireturn

  private final boolean isThereWayToShinyGold(java.lang.String, java.util.Map<java.lang.String, ? extends java.util.Set<kotlin.Pair<java.lang.Integer, java.lang.String>>>, java.util.Set<java.lang.String>);
    Code:
       0: ldc           #215                // String shiny gold
       2: aload_1
       3: invokevirtual #114                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
       6: ifeq          11
       9: iconst_1
      10: ireturn
      11: aload_2
      12: aload_1
      13: invokeinterface #243,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      18: checkcast     #161                // class java/util/Set
      21: dup
      22: ifnull        203
      25: checkcast     #29                 // class java/lang/Iterable
      28: astore        6
      30: iconst_0
      31: istore        7
      33: aload         6
      35: astore        8
      37: new           #65                 // class java/util/ArrayList
      40: dup
      41: aload         6
      43: bipush        10
      45: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      48: invokespecial #74                 // Method java/util/ArrayList."<init>":(I)V
      51: checkcast     #76                 // class java/util/Collection
      54: astore        9
      56: iconst_0
      57: istore        10
      59: aload         8
      61: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      66: astore        11
      68: aload         11
      70: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      75: ifeq          194
      78: aload         11
      80: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      85: astore        12
      87: aload         9
      89: aload         12
      91: checkcast     #163                // class kotlin/Pair
      94: astore        13
      96: astore        15
      98: iconst_0
      99: istore        14
     101: aload         13
     103: invokevirtual #246                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     106: checkcast     #248                // class java/lang/Number
     109: invokevirtual #251                // Method java/lang/Number.intValue:()I
     112: ifne          119
     115: iconst_0
     116: goto          178
     119: ldc           #215                // String shiny gold
     121: aload         13
     123: invokevirtual #254                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     126: invokevirtual #114                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     129: ifeq          136
     132: iconst_1
     133: goto          178
     136: aload_3
     137: aload         13
     139: invokevirtual #254                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     142: invokeinterface #265,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     147: ifeq          154
     150: iconst_0
     151: goto          178
     154: getstatic     #218                // Field INSTANCE:Lio/github/zebalu/advent2020/BagRuleReader;
     157: aload         13
     159: invokevirtual #254                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     162: checkcast     #45                 // class java/lang/String
     165: aload_2
     166: aload_3
     167: aload         13
     169: invokevirtual #254                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     172: invokestatic  #269                // Method kotlin/collections/SetsKt.plus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;
     175: invokespecial #227                // Method isThereWayToShinyGold:(Ljava/lang/String;Ljava/util/Map;Ljava/util/Set;)Z
     178: nop
     179: invokestatic  #274                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
     182: aload         15
     184: swap
     185: invokeinterface #82,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     190: pop
     191: goto          68
     194: aload         9
     196: checkcast     #57                 // class java/util/List
     199: nop
     200: goto          205
     203: pop
     204: aconst_null
     205: astore        4
     207: aload         4
     209: ifnull        222
     212: aload         4
     214: invokeinterface #275,  1          // InterfaceMethod java/util/List.isEmpty:()Z
     219: ifeq          226
     222: iconst_0
     223: goto          344
     226: aload         4
     228: checkcast     #29                 // class java/lang/Iterable
     231: astore        5
     233: iconst_0
     234: istore        6
     236: aload         5
     238: invokeinterface #33,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     243: astore        7
     245: aload         7
     247: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     252: ifne          266
     255: new           #277                // class java/lang/UnsupportedOperationException
     258: dup
     259: ldc_w         #279                // String Empty collection can\'t be reduced.
     262: invokespecial #280                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     265: athrow
     266: aload         7
     268: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     273: astore        8
     275: aload         7
     277: invokeinterface #39,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     282: ifeq          336
     285: aload         8
     287: aload         7
     289: invokeinterface #43,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     294: checkcast     #271                // class java/lang/Boolean
     297: invokevirtual #283                // Method java/lang/Boolean.booleanValue:()Z
     300: istore        9
     302: checkcast     #271                // class java/lang/Boolean
     305: invokevirtual #283                // Method java/lang/Boolean.booleanValue:()Z
     308: istore        10
     310: iconst_0
     311: istore        11
     313: iload         10
     315: ifne          323
     318: iload         9
     320: ifeq          327
     323: iconst_1
     324: goto          328
     327: iconst_0
     328: invokestatic  #274                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
     331: astore        8
     333: goto          275
     336: aload         8
     338: checkcast     #271                // class java/lang/Boolean
     341: invokevirtual #283                // Method java/lang/Boolean.booleanValue:()Z
     344: ireturn

  private static final java.util.Set readRules$lambda$4$lambda$3$lambda$1(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #297                // String <unused var>
       4: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #299                // class java/util/LinkedHashSet
      10: dup
      11: invokespecial #300                // Method java/util/LinkedHashSet."<init>":()V
      14: checkcast     #161                // class java/util/Set
      17: areturn

  private static final java.util.Set readRules$lambda$4$lambda$3$lambda$2(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #304,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #161                // class java/util/Set
      10: areturn

  static {};
    Code:
       0: new           #2                  // class io/github/zebalu/advent2020/BagRuleReader
       3: dup
       4: invokespecial #309                // Method "<init>":()V
       7: putstatic     #218                // Field INSTANCE:Lio/github/zebalu/advent2020/BagRuleReader;
      10: return
}

Compiled from "BagRuleReader.kt"
public final class io.github.zebalu.advent2020.BagRuleReaderKt {
}