Java Type Erasure Problem

前端 未结 5 2125
一个人的身影
一个人的身影 2021-02-11 03:11

I\'ve made an example to demonstrate my problem:

Metrical.java

public interface Metrical
{
    double distance(T other);
}
5条回答
  •  故里飘歌
    2021-02-11 03:53

    Use public class Widget implements Metrical>.

    public double distance(Widget other) {} becomes public double distance(Widget

    other) {}

提交回复
热议问题