String[] 转换成 ArrayList 报的错。

String[] str = {"A","B"};
ArrayList<String> list = (ArrayList<String>) Arrays.AsList(str);

解决:再做一次转换,把list 转换成 ArrayList

List<String> list = Arrays.AsList(str);
ArrayList<String> arrayList = new ArrayList<String>(list);

java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList的更多相关文章

  1. 关于利用动态代理手写数据库连接池的异常 java.lang.ClassCastException: com.sun.proxy.$Proxy0 cannot be cast to java.sql.Connection

    代码如下: final Connection conn=pool.remove(0); //利用动态代理改造close方法 Connection proxy= (Connection) Proxy.n ...

  2. 自定义连接池java.lang.ClassCastException: com.sun.proxy.$Proxy4 cannot be cast to java.sql.Connection

    原因:Connection.getInterfaces() 与数据库驱动有关,数据库驱动不同 Connection.getInterfaces() 的结果也就不同,Connection.getInte ...

  3. java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcStatement cannot be cast to java.beans.Statement

    当导入的包为:import java.sql.Statement;时,无任何错误 当导入的包为:import java.beans.Statement;时,出错

  4. java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext问题原因及解决方法

    一.错误信息 java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logb ...

  5. Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer错误解决办法

    严重: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"] java. ...

  6. Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer

    A child container failed during startjava.util.concurrent.ExecutionException: org.apache.catalina.Li ...

  7. java.lang.ClassCastException: com.sun.proxy.$Proxy27 cannot be cast to com.bbk.n002.service.QuestionService

    1 严重: Servlet /N002-1.0 threw load() exception 2 java.lang.ClassCastException: com.sun.proxy.$Proxy2 ...

  8. java.lang.ClassCastException: com.sun.proxy.$Proxy53 cannot be cast to cn.service.impl.WorkinggServiceImpl

    java.lang.ClassCastException: com.sun.proxy.$Proxy53 cannot be cast to cn.service.impl.WorkinggServi ...

  9. Java-Spring:java.lang.ClassCastException: com.sun.proxy.$Proxy* cannot be cast to***问题解决方案

    java.lang.ClassCastException: com.sun.proxy.$Proxy* cannot be cast to***问题解决方案 临床表现: 病例: 定义代理类: @Tra ...

  10. java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.ProgressBar$SavedState

    java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.Progress ...

随机推荐

  1. test20180922 扭动的树

    题意 分析 二叉查找树按照键值排序的本质是中序遍历,每次我们可以在当前区间中提取出一个根,然后划分为两个子区间做区间DP.记\(f(i,j,k)\)表示区间[i, j]建子树,子树根节点的父亲是第k个 ...

  2. 自己一下午练习Js的代码

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. visual studio 2014 新特性

    原文如下: Visual Studio "14" CTP Today, we are making available a first community technology p ...

  4. sql server 表变量存储临时查询数据

    对于使用sql server 编写存储过程或者类似的sql 查询的时候我们使用表变量进行临时数据的存储,可以方便我们进行下来的数据处理 表变量的使用类似如下: declare @userinfo ta ...

  5. ImageCollection

    https://documentation.devexpress.com/#WindowsForms/clsDevExpressUtilsImageCollectiontopic The collec ...

  6. bat删除系统默认共享

    在我们的系统中,有很多默认的共享是开启的,可以设置一个bat文件在每次开机的时候把共享删除. net share c$ /del net share d$ /del net share e$ /del ...

  7. HTML/CSS/Javascript代码在线压缩、格式化(美化)工具

    CSS 格式化 ProCSSor - http://procssor.com/   CSS 压缩 CSS Compressor - http://www.cssdrive.com/index.php/ ...

  8. hadoop入门学习教程--DKHadoop完整安装步骤

    使用hadoop版本是DKH标准三节点发行版,DKHadoop版本的易用性比较好,环境部署要简单的多,参考此篇安装前请先下载DKHadoop版本,网盘链接:https://pan.baidu.com/ ...

  9. Java 接口 interface implements

    接口定义了一系列的抽象方法和常量,形成一个属性集合. 接口定义完成后任何类都可以实现接口,而且一个类可以实现多个接口. 实现接口的类必须实现接口中定义的抽象方法,具体实现细节由类自己定义.可以说接口定 ...

  10. Windows Phone 的这几年

    Windows Phone 从2010年10月发布,到如今已经有3年多了.从那时坚持到现在的用户和开发者一定感慨很多吧. 一直关注着这个让人既爱又恨的平台的发展,笔者不仅是使用者,也同时是开发者,这里 ...