在 Java 中实现同名接口
Implement an interface with the same name in Java
我正在重新创建基本数据结构作为作业。我有一个名为 Queue 的接口,我必须使用相同的名称实现相同的数据结构(两者都在不同的包中)我尝试这样做但它给出了警告
Queue is a raw type. References to generic type Queue<E> should be parameterized
这是我的代码
public class Queue implements uo.mp2021.util.collections.Queue
这是什么队列?
有什么吗?
public class Queue<E> implements uo.mp2021.util.collections.Queue<E>
有什么?
public class Queue implements uo.mp2021.util.collections.Queue<Something>
重点是接口是通用的,因此您需要决定是提供通用实现还是特定实现。
我正在重新创建基本数据结构作为作业。我有一个名为 Queue 的接口,我必须使用相同的名称实现相同的数据结构(两者都在不同的包中)我尝试这样做但它给出了警告
Queue is a raw type. References to generic type Queue<E> should be parameterized
这是我的代码
public class Queue implements uo.mp2021.util.collections.Queue
这是什么队列?
有什么吗?
public class Queue<E> implements uo.mp2021.util.collections.Queue<E>
有什么?
public class Queue implements uo.mp2021.util.collections.Queue<Something>
重点是接口是通用的,因此您需要决定是提供通用实现还是特定实现。