home | career | drupal | java | mac | mysql | perl | scala | uml | unix

Groovy example source code file (Groovy4257Bug.groovy)

This example Groovy source code file (Groovy4257Bug.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

groovy4257bug, groovy4257bug, groovytestcase, groovytestcase, set, set

The Groovy Groovy4257Bug.groovy source code

package groovy.bugs

class Groovy4257Bug extends GroovyTestCase {
    void testSetUnique() {
        Set orig = [[3035, 26972], [2795, 34412]]
        Set clone = orig.clone()
        orig.unique()
        assert orig == clone
        orig.unique{ it }
        assert orig == clone
    }

    void testNumberCoercion() {
        def orig = [3, 3L, 3.0] as Set
        def expected = [3] as Set
        orig.unique()
        assert orig == expected
        orig = [3, 3L, 3.0] as Set
        orig.unique{ it }
        assert orig == expected
    }
}

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy Groovy4257Bug.groovy source code file:

new blog posts

 

Copyright 1998-2013 Alvin Alexander, alvinalexander.com
All Rights Reserved.