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;
}
2
  • Care to explain the downvote? Yes it is a straightforward question -as readily admitted in the OP. Is that not permitted on SOF? Commented Feb 3, 2014 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. Commented Feb 4, 2014 at 0:00

1 Answer 1

1

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

def rotate[T]( //...
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.