Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Way To Use Guava

Tags:

java

guava

Which is the best way you think to use Guava? Since, in the web site, the guys say that the interfaces are subject to change till they release 1.0. Taking this into account, the code you write shouldn't depend directly on those interfaces, so, are you wrapping all the Guava code you call into some kind of layer or facade in our projects in order to, if those interfaces change, then you at least have those changes centralized in one place?

Which is the best way to go? I am really interested in starting using it but I have that question hitting my mind hahah :)

like image 495
Carlos Avatar asked Sep 09 '10 15:09

Carlos


People also ask

Can guava be eaten raw?

To eat guava raw, you could eat just like any other fruit, seeds are edible but we recommend not to chew them, because they are hard seeds. Also you could slice it in half and remove seeds with a spoon. Keep in mind that guavas are very perishable.

Do you peel a guava before eating?

Every part of a guava is edible, including the flesh, the seeds, and also the rind. Some people choose to remove the seeds and rind, leaving only the juicy flesh, but a guava is far more nutritious if you eat the whole thing. Just make sure you rinse the rind well to remove any wax.


1 Answers

I'm not sure where you're getting that about the interfaces being subject to change until version 1.0. That was true with Google Collections, Guava's predecessor, but that has had its 1.0 release and is now a part of Guava. Additionally, nothing that was part of Google Collections will be changed in a way that could break code.

Guava itself doesn't even use a release system with a concept of "1.0". It just does releases, labeled "r05", "r06" and so on. All APIs in Guava are effectively frozen unless they are marked with the @Beta annotation. If @Beta is on a class or interface, anything in that class is subject to change. If a class isn't annotated with it, but some methods in the class are, those specific methods are subject to change.

Note that even with the @Beta APIs, the functionality they provide will very likely not be removed completely... at most they'll probably just change how that functionality is provided. Additionally, I believe they're deprecating the original form of any @Beta API they change for 1 release before removing it completely, giving you time to see that it's changed and update to the new form of that API. @Beta also doesn't mean that a class or method isn't well-tested or suitable for production use.

Finally, this shouldn't be much of an issue if you're working on an application that uses Guava. It should be easy enough to update to a new version whenever, just making changes here and there if any @Beta APIs you were using changed. It's people writing libraries that use Guava who really need to avoid using @Beta APIs, as using one could create a situation where you're unable to switch to a newer version of Guava in your application OR use another library that uses a newer version because it would break code in the older library that depends on a changed/removed beta API.

like image 100
ColinD Avatar answered Oct 18 '22 07:10

ColinD