We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
observerStateMap 这个map 感觉没有存在的必要,可以更加精简
private final ConcurrentHashMap<Observer<? super T>, ChangeablePair<Observer<? super T>, Boolean>> observerProxyMap = new ConcurrentHashMap();
这是我的想法,一个map就可以搞定
我觉得数据上会更好
另外针对这一行代码 改造成如下:
The text was updated successfully, but these errors were encountered:
@liweiGe
感谢你的分享和启发!
为此我的做法是,将 state 作为 ObserverProxy 的字段来管理,这样我们保留了语义的明确,没有增加学习成本,且让 Map 及其元素的使用更为简便。
private final ConcurrentHashMap<Observer<? super T>, ObserverProxy> observerMap = new ConcurrentHashMap();
@Override public void onChanged(T t) { ObserverProxy proxy = observerMap.get(target); if (proxy != null && proxy.state) { proxy.state = false; if (t != null || isAllowNullValue) { target.onChanged(t); } } }
目前已将本次修改的结果纳入 V6.1 更新。
Sorry, something went wrong.
No branches or pull requests
observerStateMap 这个map 感觉没有存在的必要,可以更加精简
private final ConcurrentHashMap<Observer<? super T>, ChangeablePair<Observer<? super T>, Boolean>> observerProxyMap = new ConcurrentHashMap();
这是我的想法,一个map就可以搞定
我觉得数据上会更好
另外针对这一行代码
改造成如下:
The text was updated successfully, but these errors were encountered: