• <i id='elS95'><tr id='elS95'><dt id='elS95'><q id='elS95'><span id='elS95'><b id='elS95'><form id='elS95'><ins id='elS95'></ins><ul id='elS95'></ul><sub id='elS95'></sub></form><legend id='elS95'></legend><bdo id='elS95'><pre id='elS95'><center id='elS95'></center></pre></bdo></b><th id='elS95'></th></span></q></dt></tr></i><div id='elS95'><tfoot id='elS95'></tfoot><dl id='elS95'><fieldset id='elS95'></fieldset></dl></div>

    <small id='elS95'></small><noframes id='elS95'>

          <bdo id='elS95'></bdo><ul id='elS95'></ul>
        <tfoot id='elS95'></tfoot>

      1. <legend id='elS95'><style id='elS95'><dir id='elS95'><q id='elS95'></q></dir></style></legend>

        SortedSet、数组、可序列化的序列化问题

        Serialization issue with SortedSet, Arrays, an Serializable(SortedSet、数组、可序列化的序列化问题)
      2. <tfoot id='wwvjN'></tfoot>

          1. <small id='wwvjN'></small><noframes id='wwvjN'>

            <i id='wwvjN'><tr id='wwvjN'><dt id='wwvjN'><q id='wwvjN'><span id='wwvjN'><b id='wwvjN'><form id='wwvjN'><ins id='wwvjN'></ins><ul id='wwvjN'></ul><sub id='wwvjN'></sub></form><legend id='wwvjN'></legend><bdo id='wwvjN'><pre id='wwvjN'><center id='wwvjN'></center></pre></bdo></b><th id='wwvjN'></th></span></q></dt></tr></i><div id='wwvjN'><tfoot id='wwvjN'></tfoot><dl id='wwvjN'><fieldset id='wwvjN'></fieldset></dl></div>
              <bdo id='wwvjN'></bdo><ul id='wwvjN'></ul>

                  <tbody id='wwvjN'></tbody>

                <legend id='wwvjN'><style id='wwvjN'><dir id='wwvjN'><q id='wwvjN'></q></dir></style></legend>
                • 本文介绍了SortedSet、数组、可序列化的序列化问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在处理之前有这个:

                  protected void onPostExecute(SortedSet<RatedMessage> result) {
                      List<Object> list=Arrays.asList(result.toArray());
                      lancon.putExtra("results", list.toArray()); // as serializable
                  }
                  

                  然后在另一部分我有

                  Object o=this.getIntent().getSerializableExtra("results");
                  //at this point the o holds the correct value (checked by debugger)
                  RatedMessage[] rm = (RatedMessage[]) o;// this line hangs out w ClassCastException
                  resultSet = new TreeSet<RatedMessage>(new Comp());
                  Collections.addAll(resultSet, rm);
                  

                  为什么我得到 ClassCastException?

                  Why I get the ClassCastException?

                  推荐答案

                  我终于让它这样工作了:

                  Finally I got it to work this way:

                  Serializable s = this.getIntent().getSerializableExtra("results");
                  Object[] o = (Object[]) s;
                  if (o != null) {
                      resultSet = new TreeSet<RatedMessage>(new Comp());
                      for (int i = 0; i < o.length; i++) {
                          if (o[i] instanceof RatedMessage) {
                              resultSet.add((RatedMessage) o[i]);
                          }
                      }
                  }
                  

                  这篇关于SortedSet、数组、可序列化的序列化问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Compiling C++ for the JVM(为 JVM 编译 C++)
                  Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                  How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                  Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                  How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                  Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)

                  <legend id='uWot4'><style id='uWot4'><dir id='uWot4'><q id='uWot4'></q></dir></style></legend>

                  <small id='uWot4'></small><noframes id='uWot4'>

                • <tfoot id='uWot4'></tfoot>
                    <bdo id='uWot4'></bdo><ul id='uWot4'></ul>
                      <tbody id='uWot4'></tbody>

                        <i id='uWot4'><tr id='uWot4'><dt id='uWot4'><q id='uWot4'><span id='uWot4'><b id='uWot4'><form id='uWot4'><ins id='uWot4'></ins><ul id='uWot4'></ul><sub id='uWot4'></sub></form><legend id='uWot4'></legend><bdo id='uWot4'><pre id='uWot4'><center id='uWot4'></center></pre></bdo></b><th id='uWot4'></th></span></q></dt></tr></i><div id='uWot4'><tfoot id='uWot4'></tfoot><dl id='uWot4'><fieldset id='uWot4'></fieldset></dl></div>