• <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、数组、可序列化的序列化问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                  <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>