| Autor |
Mensagem |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/04/2009 04:57:54
|
Bruno Laturner
GUJ Expert
![[Avatar]](/images/avatar/5800ccd9514fd789d08e5831951aa6bc.jpg)
Membro desde: 18/02/2008 16:17:53
Mensagens: 3002
Offline
|
Achei uma biblioteca bem legal ouvindo o JavaPosse desta semana, o Google Collections. Os próprios autores se referem a ela como um Collections++, uma extensão natural da API de Collections do Java SE.
O que achei de melhor:
MultiMaps - basicamente um Map onde do lugar de retornar um valor para uma chave, retorna uma coleção de valores. Desse modo dá para associar uma chave à mais de um valor.
Ordering - um Comparator com dezenas de métodos úteis.
e muitas classes utilitárias, em especial o Iterators e Iterables, e seus métodos que simulam closures, como find, filter, any, all, e o transform.
Coleções imutáveis - de verdade, até onde é possível ser.
Ainda está em Release Candidate, então cuidado ao usar em produção (apesar que o próprio Google usa muito, em produção).
Fica aí a dica.
PS: De brinde, o vídeo de apresentação do projeto: Parte 1, parte 2.
This message was edited 1 time. Last update was at 10/04/2009 05:07:26
|
A resposta acima foi achada em menos de 5 minutos no google.
The prisoner falls in love with his chains. --E.W. Dijkstra |
|
|
 |
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 13/04/2009 22:20:32
|
garcia-jj
JWizard
Membro desde: 13/04/2009 22:11:50
Mensagens: 2715
Localização: Porto Alegre
Offline
|
Muito útil, e embora eu ache o projeto do jakarta commons bem mal feito, esse projeto do google collections me parece um reinventar a roda. Pq não unir forças ao jakarta commons collections para evolui-la?
This message was edited 1 time. Last update was at 14/04/2009 11:37:39
|
http://github.com/garcia-jj
Não respondo dúvidas via MP. Use o fórum. |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 14/04/2009 09:33:04
|
Rafael Afonso
Virtual Machine Man
Membro desde: 05/12/2002 16:03:43
Mensagens: 719
Localização: São Paulo/SP
Offline
|
garcia-jj wrote:Muito útil, e embora eu achei o projeto do jakarta commons, esse projeto do google collections me parece um reinventar a roda. Pq não unir forças ao jakarta commons collections para evolui-la?
google-collections wrote:
Why did Google build all this, when it could have tried to improve the Apache Commons Collections instead?
The Apache Commons Collections very clearly did not meet our needs. It does not use generics, which is a problem for us as we hate to get compilation warnings from our code. It has also been in a "holding pattern" for a long time. We could see that it would require a pretty major investment from us to fix it up until we were happy to use it, and in the meantime, our own library was already growing organically.
An important difference between the Apache library and ours is that our collections very faithfully adhere to the contracts specified by the JDK interfaces they implement. If you review the Apache documentation, you'll find countless examples of violations. They deserve credit for pointing these out so clearly, but still, deviating from standard collection behavior is risky! You must be careful what you do with such a collection; bugs are always just waiting to happen.
Our collections are fully generified and never violate their contracts (with isolated exceptions, where JDK implementations have set a strong precedent for acceptable violations). This means you can pass one of our collections to any method that expects a Collection and feel pretty confident that things will work exactly as they should.
Fonte: http://code.google.com/p/google-collections/wiki/Faq
|
Rafael Ubiratam Clemente Afonso
---------------------------------------
GitHub
ScalaFX
LinkedIn |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 18/10/2009 22:20:46
|
garcia-jj
JWizard
Membro desde: 13/04/2009 22:11:50
Mensagens: 2715
Localização: Porto Alegre
Offline
|
Saiu o rc3. http://code.google.com/p/google-collections/wiki/Releases
|
http://github.com/garcia-jj
Não respondo dúvidas via MP. Use o fórum. |
|
|
 |
|
|