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. DesignPattern(二) 创建型模式

    创建型模式 创建型模式就是用来创建对象的模式,抽象了实例化的过程.所有的创建型模式都有两个共同点.第一,它们都将系统使用哪些具体类的信息封装起来:第二,它们隐藏了这些类的实例是如何被创建和组织的.创建 ...

  2. oracle 脚本创建数据库的相关文章,教程,源码

    学步园推荐专题: 关于oracle 脚本创建数据库的相关文章 文章标题 文章链接 文章简介 oracle命令行创建数据库的示例脚本 http://www.xuebuyuan.com/964527.ht ...

  3. addFrameScript用法

    如何判断一个mc播放完毕之后remove掉他呢, 目前我发现的两种做法,一种是: var boomMc:MovieClip = LoadResource.getMC("boom", ...

  4. 蚂蚁金服 Service Mesh 实践探索

    SOFAMesh是蚂蚁金服在ServiceMesh方向上的探索,下面是它高级技术专家敖小剑在QCon上海2018上的演讲. Service Mesh 是一个 基础设施层,用于处理服务间通讯.现代云原生 ...

  5. php生成文字图片效果

    php生成文字图片效果最近看到php的GD功能,试着做了一个基本生成文字图片效果的代码: 显示文字图片页面:demo.php<?php$str = $_REQUEST['str'] ? $_RE ...

  6. 微软正式发布Windows 1.0 回顾历代Windows版本界面

    在刚过去的上月底,Windows XP过完了12岁生日,在今天我们又欢快地迎来了Windows的生日.在1985年11月20日,微软正式发布Windows 1.0,它基于的是MS-DOS系统,实际上其 ...

  7. thinkphp配置rewrite模式访问时不生效 出现No input file specified解决方法

    使用thinkphp配置rewire模式的路径访问网站时, 直接复制官网的.htaccess文件的代码复制过去 1 2 3 4 5 6 <IfModule mod_rewrite.c>   ...

  8. 更新RDL文件中的数据集(DataSets)

    由于RDL XML文件中使用了两个命名空间: <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/ ...

  9. 再记录一次delete出错的经历

    调试的时候进行到delete语句时出现问题,我做的操作是在函数体内用int*申请了N个内存空间,这让我十分纳闷,为什么不能delete呢? 回忆到之前delete出错也遇过一次问题 手动封装OpenC ...

  10. IDEA无法下载plugin的解决办法

    有些时候我们在用IDEA安装plugins的时候,会因为各种原因搜索不到想要的依赖,或者搜索到却无法安装,针对这个问题,现在这里有两种方法可以尝试一下. 第一种: 找到settings->sys ...