java 参数类,具有2个通用参数的Java类

I'm trying to crate my own thread safe event handling but I get E cannot be resolved to a type error on class decleration line below. How can I fix this?

Observers.java

public final class Observers> {

private CopyOnWriteArrayList mListeners = new CopyOnWriteArrayList();

public interface EventHandler {

public void HandleEvent(Object sender, E e);

}

/*...*/

public void dispatchEvent(Object sender, E args) {

/*...*/

}

}

EventHandler.java

public interface EventHandler {

/* ... */

}

解决方案

You've only actually declared a single type parameter in Observers. Try this:

public final class Observers> {

Note that it looks highly odd for your Observers class to declare its own nested EventHandler interface while implementing the outer one - if you really need both of those, I would suggest you rename one of them.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值