Groovy简单再入门
2024-08-31 00:55:28
以前试过,忘得差不多了,趁这次从JAVA一直撸到SERVLET,SPRING,GROOVY,GRAILS的机会,再弄一次吧。。。
def authors = [ "Peter Ledbrook", "Glen Smith" ] def quoteParts = [ ["Time", "waits", "for no man"], ["The roundhouse kick", "solves", "all problems"], ["Groovy", "is", "the bees knees"] ] for (i in 0..10) { def quote = createQuote(quoteParts, authors) println quote } String createQuote(List quoteParts, List authors) { def rand = new Random() def n = quoteParts.size() def m = authors.size() return quoteParts[rand.nextInt(n)][0] + ' ' + quoteParts[rand.nextInt(n)][1] + ' ' + quoteParts[rand.nextInt(n)][2] + ' by ' + authors[rand.nextInt(m)] }
最新文章
- AFNetworking的封装
- 利用jQuery对插件进行扩展时,方法$.extend()、$.fn.extend()区别与联系
- WebLogic中的一些基本概念
- js控住DOM实现发布微博简单效果
- 初识Hadoop入门介绍
- 一款查看mysql QPS的脚本
- 【CSU1808】地铁
- javascript的变量、作用域和内存问题
- SQLite简介
- SqlServer 查询死锁,杀死死锁进程
- 深入理解Java内部类
- js 正则进阶regexp
- sql 同步2个表中的一个字段数据
- Kotlin(一)
- web集成高德地图
- Mac OS X 下优化 Terminal,一篇就够了!
- python之Django实现商城从0到1
- Leetcode题库——36.有效的数独
- output-operations-on-dstreams
- kernel jenkins build script