zoukankan      html  css  js  c++  java
  • groovy对枚举的支持

    /**
     * Created by Jxy on 2019/1/3 15:42
     * groovy对枚举的支持
     */
    
    enum CoffeeSize{
        SHORT,SMALL,BIG,MUG
    }
    def orderCoffee(size){
        println "coffee is $size"
        switch (size){
            case [CoffeeSize.SHORT,CoffeeSize.SMALL]:
                println "your are health conscious"
                break
            case [CoffeeSize.BIG,CoffeeSize.MUG]:
                println "your are big health conscious"
                break
        }
    }
    orderCoffee(CoffeeSize.MUG)
    for(size in CoffeeSize.values()){
        print "$size ,"
    }
  • 相关阅读:
    java后端
    2017-12-11
    二叉树与分治法整理
    javaweb
    安装docker
    爬虫
    lintcode
    DEEPlearning
    剑指offer_by牛客网
    DFS
  • 原文地址:https://www.cnblogs.com/jsersudo/p/10214746.html
Copyright © 2011-2022 走看看