問題タブ [unmodifiable]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
893 参照

java - UnmodifiableRandomAccessList を Set に設定する方法 in java

There is an Oauth2Authentication object that contains user-authority. When I want to get its authority and set it in authority of User object like this:

OAuth2Aut

There is an Oauth2Authentication object that contains user-authority. When I want to get its authority and set it in authority of User object like this:

the following exception is raised:

java.lang.ClassCastException: java.util.Collections$UnmodifiableRandomAccessList cannot be cast to java.util.Set

How do I fix it?

Note:
The type of Authorities of User object is Set<GrantedAuthority>


Restarted Visual Studio twice solved my problem.

First, I restarted but it did not work. Then, I did almost everything but still didn't work.

Then, restarted again solved my problem.