Skip to content

Instantly share code, notes, and snippets.

Q:
Write a function in Java taking string and returning string, which is
“3” if the input string represents a positive number evenly divisible by 3
“5" if the input string represents a positive number evenly divisible by 5
“15” if the input string represents a positive number evenly divisible by 15
and the input string itself otherwise.

A:
Here's one possible implementation of a function that takes a string as input and returns a string as output, based on the conditions you've described:

trait PlayerProfile
trait PlayerProps
trait Signal
type EnrichedSignal = (Signal, PlayerProfile, PlayerProps)
val sc: StreamingContext = ???
val ss: DStream[(String, Signal)] = ???
val as: DStream[(String, PlayerProfile)] = ???
val ps: DStream[(String, PlayerProps)] = ???

Syntactic Style

  • Use tabs for indentation.
  • Add a newline to the end of every file.
  • There must not be whitespace characters at the end of a line