Domanda

They seem identical to java.util counterparts. In a project I have to review these apis are used and an external jar is present for that.

But...in what they are different from java.util ones?

È stato utile?

Soluzione

The Guava libraries, much like the Apache Commons libraries, are intended to complement the core java libraries, as outlined in the Philosophy Explained document:

Guava is a productivity multiplier for Java projects across the board: we aim to make working in the Java language more pleasant and more productive. The JDK utilities, e.g. the Collections API, have been widely adopted and have significantly simplified virtually all Java code. We hope to continue in that tradition.

That article goes on to explain how they realise that you could implement the procedures they provide to fill the gaps in the core API yourself, but believe there are a number of advantages to using their code:

  • Guava has been battle-tested in production at Google.
  • Guava has staggering numbers of unit tests: as of July 2012, the guava-tests package includes over 286,000 individual test cases. Most of these are automatically generated, not written by hand, but Guava's test coverage is extremely thorough, especially for com.google.common.collect.
  • Guava is under active development and has a strong, vocal, and involved user base.
  • The best libraries seem obvious in retrospect, but achieving this state is notoriously challenging.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top