1

In an overridden method I'd like to return an empty map. How I'm trying to make it work:

override myMethod() {
    #{} // cannot convert from Map<Object, Object> to Map<String,MyClass>
}

And what is working for me but not so "Xtend-ish":

override myMethod() {
    Collections.emptyMap // Works
}
Adam Horvath
  • 1,249
  • 1
  • 10
  • 25

1 Answers1

1

The following should work

override Map<String,MyClass> myMethod() {
    #{}
}
Sven Efftinge
  • 3,065
  • 17
  • 17
  • "#{} as Map" is working as a return statement but actually, I was hoping to get rid of generics and just type some fancy expression. – Adam Horvath Sep 21 '18 at 14:57