Hashset:

HashSet set = new HashSet()
set.add("India")
set.add("USA")
set.add("China")
log.info "Set size is : " + set.size() set.add("China")
log.info "Set size is : " + set.size() Iterator iter = set.iterator();
log.info "If has next : " +iter.hasNext()
log.info iter.next()
while(iter.hasNext()){
log.info iter.next()
}

Result :

Tue Jun 16 15:02:49 CST 2015:INFO:Set size is : 3
Tue Jun 16 15:02:49 CST 2015:INFO:Set size is : 3
Tue Jun 16 15:02:49 CST 2015:INFO:If has next : true
Tue Jun 16 15:02:49 CST 2015:INFO:USA
Tue Jun 16 15:02:49 CST 2015:INFO:China
Tue Jun 16 15:02:49 CST 2015:INFO:India

Hashtable :

Hashtable table = new Hashtable()
table.put("name","Henry")
table.put("country","Russia")
table.put("telephone","13658988546")
table.put("email","henry.wasley@gmail.com") log.info "Size of table is " + table.size()
log.info "Name is " + table.get("name")
log.info "Country is " + table.get("country")

Result :

Tue Jun 16 15:06:55 CST 2015:INFO:Size of table is 4
Tue Jun 16 15:06:55 CST 2015:INFO:Name is Henry
Tue Jun 16 15:06:55 CST 2015:INFO:Country is Russia

[Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] HashSet and Hashtable的更多相关文章

  1. [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Exception Handling in groovy

    def x = new String[3] x[0] = "A" x[1] = "B" x[2] = "C" log.info"X ...

  2. [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Array and ArrayList

    Array: def x = new String[5] x[0] = "India" x[1] = "USA" x[2] = "Korea" ...

  3. Common tasks that you can perform with the Groovy Script test step

    https://support.smartbear.com/readyapi/docs/soapui/steps/groovy.html Get test case object To obtain ...

  4. [Training Video - 2] [Groovy Introduction]

    Building test suites, Test cases and Test steps in SOAP UI Levels : test step level test case level ...

  5. [Training Video - 4] [Groovy] Optional parameter in groovy

    Employee.log=log Employee e1 = new Employee() log.info e1.add(1,2,3,4) // optional parameters in gro ...

  6. [Training Video - 4] [Groovy] String Functions

    def x="I like to read books before bed" def temp = x.split(" ") log.info "S ...

  7. [Training Video - 4] [Groovy] Object equality and variable equality check

    def x=2 def y=3 if(x == y){ log.info "equal" }else{ log.info "not equal" // prin ...

  8. [Training Video - 4] [Groovy] Initializing log inside class with constructor

    TestService s = new TestService(log,context,testRunner) s.xyz() class TestService{ def log def conte ...

  9. [Training Video - 4] [Groovy] Constructors in groovy, this keyword

    Bank.log = log Bank b1 = new Bank() b1.name = "BOA" b1.minbalance = 100 b1.city="Lond ...

随机推荐

  1. Redis学习笔记-常用命令篇(Centos7)

    redis提供了丰富的命令,这些命令可以在linux终端使用.在各类语言中,这些命令都有对应的方法. 一.键值相关 1.keys 返回满足给定pattern的所有key 127.0.0.1:6379& ...

  2. (转)关于fflush(stdin)清空输入缓存流(C/C++)

    来源:http://my.oschina.net/deanzhao/blog/79790 1. 为什么 fflush(stdin) 是错的?首先请看以下程序: #include <stdio.h ...

  3. WF从入门到精通学习目录

    WF从入门到精通(第一章):WF简介 WF从入门到精通(第二章):workflow运行时 WF从入门到精通(第三章):workflow实例 WF从入门到精通(第四章):活动及workflow类型介绍 ...

  4. windows dos权限管理

    显示或者修改文件的访问控制列表(ACL) CACLS filename [/T] [/M] [/L] [/S[:SDDL]] [/E] [/C] [/G user:perm]              ...

  5. bzoj 2007 [Noi2010]海拔——最小割转最短路

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2007 一个点的高度一定不是0就是1.答案一定形如一个左上角的连通块全是0的点.一个右下角的连 ...

  6. bzoj2004公交线路

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2004 好美妙的矩阵乘. 思考: 0.在一个序列上.所以考虑dp. 1.p<=10,k& ...

  7. 设置vim颜色方案

    获取所有vim颜色配置方案 ls /usr/share/vim/vim74/colors/ [root@lx ~]# ls /usr/share/vim/vim74/colors/ blue.vim ...

  8. 善待Erlang 代码 -- Xref 实践

    Xref 是一个交叉引用工具,通过分析定义的函数间的调用关系,用于查找函数. 模块. 应用程序和版本之间的依赖关系. 通俗而言,Xref 可以检查代码中函数的调用关系.比如在 moduleA 中的 f ...

  9. bzoj4403 两个串

    Description 兔子们在玩两个串的游戏.给定两个字符串S和T,兔子们想知道T在S中出现了几次, 分别在哪些位置出现.注意T中可能有“?”字符,这个字符可以匹配任何字符. Input 两行两个字 ...

  10. 解决phpexcel保存时文件命中文出现 乱码 (这个真的有用)

    Phpexcel导出Excel文件时有两个主要的过程: 1.定义文件名 2.填充Excel数据 这两个过程中可能会出现一些乱码问题,下面我来说一下解决办法: 解决文件名的乱码: 乱码原因:客户使用的中 ...