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. maven安装之后,或者升级之后遇到的问题:could not find or load main class org.codehaus.plexus.class.....

    从maven2升级到maven3或者从maven3降级到maven2,M2_HOME环境变量改变后,在终端执行mvn -v,出现如下错误: Exception in thread "main ...

  2. 升级到SQL Server 2012/2014时一些需要考虑的事项

    1. 使用Upgrade Adviser评估升级前需要解决的事情. https://msdn.microsoft.com/zh-cn/library/ms144256(v=sql.110).aspx ...

  3. vue+webpack多个项目共用组件动态打包单个项目

    原文复制:https://www.jianshu.com/p/fa19a07b1496 修改了一些东西,因为sh脚本不能再window电脑执行,所以改成了node脚本.这是基于vue-cli2.0配置 ...

  4. TimescaleDB 简单试用

    TimescaleDB 是一个对于pg进行了改造的时序数据库 安装测试使用docker 安装&&运行 docker run -d --name timescaledb -p 5432: ...

  5. Centos 6 安装 配置 oracle11g R2

    1.安装centos6.3_64位: 下载地址:http://mirror.bit.edu.cn/centos/6.3/isos/x86_64/ CentOS-6.3-x86_64-bin-DVD1. ...

  6. 【python】使用Python中的urlparse、urllib抓取和解析网页

    一.解析URL 函数urlparse(urlstring [, default_scheme [, allow_fragments]])的作用是将URL分解成不同的组成部分,它从urlstring中取 ...

  7. LCD RGB 控制技术讲解 — 时钟篇(上)

    时序图 下面是LCD RGB 控制的典型时序图  天啊,一下就上这玩意,怎么看??? 其实要解释上面的时序图,我们还需要了解一些LCD的显示过程.所以现在只是有个印象,稍后我们详细讲解. LCD显示流 ...

  8. 文件读取错误UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 884: invalid start byte

    参考: https://segmentfault.com/q/1010000004268196/a-1020000004269556 ubuntu下Python3使用open('filename', ...

  9. MMO技能系统的同步机制分析

    转自:http://www.gameres.com/729629.html 此篇文章基于之前文章介绍的技能系统,主要介绍了如何实现MMO中的技能系统的同步.阅读此文章之前,推荐首先阅读前一篇文章:一个 ...

  10. 在window的IIS中搭配Php的简单方法

    在window的IIS中搭配Php的简单方法.搭配php的时候找到的一个超级简单方法 关键的核心是 PHP Manager for IIS 这是微软开发的一个项目,使用它可以在window下最方便简单 ...