0

This is a cakewalk question: how to properly declare the T Type parameter in this object method Xforms.rotate? Note it would not be my intention to provide type parameters to the object itself..

object Xforms {
  def rotate(data : Traversable[T]) = { }
}

For clarification I would be looking for a more or less equivalent of

public static <T> T rotate(T data) {
    T newData = null;
    // perform rotations on newData ..
    return newData;
}
dhg
  • 52,383
  • 8
  • 123
  • 144
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • Care to explain the downvote? Yes it is a straightforward question -as readily admitted in the OP. Is that not permitted on SOF? – WestCoastProjects Feb 03 '14 at 23:20
  • 4
    Not the downvoter, but the downvote is justified seeing as typing "scala method type parameter" into google gets you a page full of your answer. – dhg Feb 04 '14 at 00:00

1 Answers1

1

The type parameters for a method come after the method name.

def rotate[T]( //...
hsun324
  • 549
  • 3
  • 9