Java – unchecked transformation

I don't want to suppress the warning Is there another way to handle this warning?

An expression of type iterator requires an unchecked conversion to conform to iterator

Iterator<String> it = schemaJSON.getJSONObject("body").keys();

Solution

You can find your answer here: type safety warning with JSON iterator

Iterator<?> it = schemaJSON.getJSONObject("body").keys();

while(it.hasNext())
{
     String next = (String) it.next();
     ...
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>