• <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、数组、可序列化的序列化问题

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

                  上一篇:我如何接受集合的并集? 下一篇:Android Parcelable - 使用通用数据类型读取/写入数据到 Parcel

                  相关文章

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

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