Graderpractice for programmers

231322 Java U6 - Streams

Awaiting submission
  • Read 5 Strings
  • Add them to a Stream
  • Print all the Strings
    ...using .forEach()
Awaiting submission
  • Read 5 Strings
  • Add them to a Stream
  • Remove words < 4 chars
    ...using .filter()
  • Print all the Strings
    ...using .forEach()
Awaiting submission
  • Read 3 Strings (with next not nextline)
  • Add them to a Stream
  • Take just the first character
    ...using .map()
  • Convert to uppercase
    ...using .map()
  • Print on one line (with print not println)
Awaiting submission
  • Read 5 ints (sides of squares)
  • Add them to an IntStream
  • Calculate area (n * n)
  • Print (println can take int)
Awaiting submission
  • Read 5 doubles (sides of triangles)
  • Add them to a DoubleStream
  • Calculate area (static method)
    sp = 3.0 * side / 2.0
    area = √(sp * (sp - side)3)
  • Print on one line (1 dp)
Awaiting submission
  • Read a String
  • Split & Stream the parts
    Arrays.stream(input.split(" "))
  • Print each word
    ...on one line
Awaiting submission
  • Read 4 Strings
  • Map to their lengths (length is an int...)
  • Call .sum() (only on IntStream)
  • Print