Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String foo() {
- // will be automatically converted to a String on account of the return type
- new StringBuilder('foo')
- }
- assert foo() == 'foo'
- Set<Integer> foo() {
- // will be automatically converted to a Set on account of the return type
- [1, 2, 2]
- }
- assert foo().size() == 2
- Integer foo(Object[] a) {
- a.length
- }
- List myList = [1, 2, 3]
- assert 3 == foo(myList)
- Integer foo(Object[] a) {
- a.length
- }
- List myList = [1, 2, 3]
- assert 3 == foo(myList.toArray())
- Integer foo(Integer[] l) {
- l.size()
- }
- assert 3 == foo([1, 2, 3])
- Integer foo(Object[] l) {
- l.size()
- }
- def list = [1, 2, 3]
- assert 3 == foo(*list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement