Java: Collections.emptyMap() casting

When using the constant


Java always complains about "Type Safety" and "Uncchecked conversions".

Well something I did not know was that methods can be paramterized like this:

Collections.<String, Long> emptyMap()

Of course this works for other methods as well.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply