Skip to content

Latest commit

 

History

History
28 lines (15 loc) · 999 Bytes

Exercises1.md

File metadata and controls

28 lines (15 loc) · 999 Bytes

Exercises

  1. Sorting Strings

    Create a list of strings. Sort them alphabetically. Sort them by length. Sort them by length in descending order.

    Advanced: Sort by length, then sort equal length strings alphabetically

  2. Processing a list of numbers

    Create a list of numbers. Add them together. First double each number, then add them up. Compute their average.

  3. Reading a web page

    Using the Groovy JDK, access your home page and display the source code. Print the length of each line of the home page.

  4. Closures as a filter

    Create a list of numbers. Print all elements greater than zero.

  5. Multi-line strings

    Make a multi-line string. Compute the number of vowels on each line.

  6. Padded binary output

    Print the numbers from 0 to 15 in binary (use Java's Integer.toBinaryString() method). Use a method in String from the Groovy JDK to make all the output values have four digits.