java.util.Objects

109 views
Skip to first unread message

Thomas Oellrich

unread,
Apr 12, 2011, 7:24:02 AM4/12/11
to guava-...@googlegroups.com
It seems that parts of com.google.common.base.Objects made it into JDK 7:

http://download.java.net/jdk7/docs/api/java/util/Objects.html

Congratulations! I was wondering what the consensus was on java.util.Objects#requireNonNull which seems to clash with Preconditions.checkNotNull or is it too early to say?

Cheers
Thomas

Todd Vierling

unread,
Apr 12, 2011, 9:13:45 AM4/12/11
to Thomas Oellrich, guava-...@googlegroups.com
On Tue, Apr 12, 2011 at 7:24 AM, Thomas Oellrich <toel...@gmail.com> wrote:
> Congratulations! I was wondering what the consensus was on
> java.util.Objects#requireNonNull which seems to clash with
> Preconditions.checkNotNull or is it too early to say?

They don't clash; they provide effectively the same functionality with
a slightly different interface.

Johan Van den Neste

unread,
Apr 12, 2011, 11:11:31 AM4/12/11
to guava-discuss
> It seems that parts of com.google.common.base.Objects made it into JDK 7:

Any other parts of guava that made it into JDK 7?

Colin Decker

unread,
Apr 12, 2011, 11:19:46 AM4/12/11
to Thomas Oellrich, guava-...@googlegroups.com
As far as I know (and maybe I'm wrong about this), I don't think java.util.Objects was based on Guava's Objects class. I think it's just a different class called Objects that happens to have some methods with the same functionality (because they make sense there). I find requireNonNull() being there kind of odd, since a class like Preconditions seems like a much more sensible place for it. I guess they decided requireNonNull() was worth it but that a more full-featured class was not at this time.

-- 
Colin


On Tue, Apr 12, 2011 at 7:24 AM, Thomas Oellrich <toel...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages