Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5064

array as a native generic

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.9-beta-3
    • None
    • syntax
    • Allow use normal sintax arrays with resources like generic and include simple operations sintax to handle itens

    Description

      Native generic in array reestruturation

      • normal array = typed collection with static size
        string[] arr = new string[10];
      • array as generic, typed collection with dynamic size
        string[] arr= new string[*];
      • operation with arrays
        arr += "nome"; // = list.add("nome");
        arr1 += arr2; // [1,2] + [3,4] = [1,2,3,4];
        arr -= "nome2"; // = list.removeInSearchContent("nome2");
        arr = arr * "nome"; // set all itens = "nome";
        arr = arr / "nome"; // remove all items = "nome";
        arr[1] = null; // way to remove item without resize;
        arr[1].dispose(); // remove item and resize;
      • comparisson with arrays
        arr1 > arr2 or arr1< arr2; // compare length
        arr1== arr2; // compare equality with each ite, content
      • to simulate dynamic type like generic:
        def[] arr = new def[*]

      obs.: the index first must 1 based like in SQL(is more intuitive)

      Attachments

        Activity

          People

            Unassigned Unassigned
            jsenaribeiro Jonathan de Sena Ribeiro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 504h
                504h
                Remaining:
                Remaining Estimate - 504h
                504h
                Logged:
                Time Spent - Not Specified
                Not Specified