Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] [JAVA] Comparator retorna um elemento errado

Valeu Marcelo.
Graças a sua dica, tentei então Long.valueOf(t2.time()).compareTo(t1.time()); e resolveu.



Em 9 de janeiro de 2014 00:08, Marcelo Alves <marcelo.alves@gmail.com> escreveu:

Provavelmente overflow, você ta convertendo a subtração pra um inteiro.

On Jan 8, 2014 11:24 PM, "Gink Labrev" <gink.labrev@gmail.com> wrote:
Pessoal,

O código aí está produzindo um resultado inesperado.

É bem simples. insiro elementos que tem um campo long em um Array e ordeno de forma decrescente através de um Comparator.

E todos retornam conforme esperado, menos o primeiro que deveria ser o ultimo.

Alguém sabe o que pode estar acontecendo ?

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário