The truth is that many do not like (to be resistance to change), I think it robs the objects work, for me this feature should be an Object or otherwise, do not know. Beyond my humble opinion was necessary, we always had to write a util to do things that makes this library hours.
showFoo public void (Foo foo) {Foo foo2 = new Foo (); / / lot of code
. println ("Two Men");
} else {System.out.println ("And a Half ");
}}
lot of code if (Objects.equals (foo, foo2)) {
NullPointer
This can see how we solve it with Objects:
showFoo public void (Foo foo) {
Foo foo2 = new Foo ();
/ /
System.out.println ("Two Men");
} else {System.out.println ("And a Half");}
}
We can make hash with Objects, which will be of org.apache.commons.lang.builder.HashCodeBuilder
@ Override public int hashCode () {return
Objects.hash (name, age, job);}
We can check that an object is null public void
showFoo (Foo foo) {
this.bar = Objects.requireNonNull (foo);}
We take take the toString if not null, and otherwise return a value: return
Objects.toString (foo, "Foo is Empty");
Source:
Interesting no? they think the new library?
http://alexsotob.blogspot.com/2011/04/another-shot-of-whiskey-cant-stop.html
0 comments:
Post a Comment