0
Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

Project Coinより小さなCoin

3,183

Published on

Published in: Technology, Education
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
3,183
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
19
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript

• 2. Objects Short Long Integer Character Byte Boolean CollectionsAssertionError InetAddress ThrowableProcessBuilder Calendar
• 3. Objects Short Long Integer Character Byte Boolean CollectionsAssertionError InetAddress ThrowableProcessBuilder Calendar
• 4. Objectspublic static boolean equals(Object a, Object b)public static boolean deepEquals(Object a, Object b)public static int hashCode(Object o)public static int hash(Object... values)public static String toString(Object o)public static String toString(Object o, String nullDefault)public static <T> int compare(T a, T b, Comparator<? super T> c)public static <T> T requireNonNull(T obj)public static <T> T requireNonNull(T obj, String message)
• 5. Objects#equalsObject o1 = new Object();Object o2 = o1;assert Objects.equals(o1, o2); // true// ==// false equals// return (a == b) || (a != null && a.equals(b))assert Objects.equals("aaa", "aaa"); // true
• 6. Objects#deepEqualsint[][] a1 = { {1, 2, 3}, {4, 5, 6} };int[][] a2 = { {1, 2, 3}, {4, 5, 6} };// Arrays.deepEqualsassert Objects.deepEquals(a1, a2); // true
• 7. Objects#toString// 2// String.valueOfString s1 = Objects.toString("aaa", "null value");assert s1.equals("aaa"); // trueString s2 = Objects.toString(null, "null value");assert s2.equals("null value"); // true
• 8. Objects#requireNonNullvoid setName(String name) { // null this.name = Objects.requireNonNull(name, " ");}
• 9. Objects Short Long Integer Character Byte Boolean CollectionsAssertionError InetAddress ThrowableProcessBuilder Calendar
• 10. #compare // 0 x -1 // x 1java.lang.Short#compare(short x, short y)java.lang.Long#compare(long x, long y)java.lang.Integer#compare(int x, int y)java.lang.Character#compare(char x, char y)java.lang.Byte#compare(byte x, byte y)java.lang.Boolean#compare(boolean x, boolean y)
• 11. Objects Short Long Integer Character Byte BooleanCollectionsAssertionError InetAddress ThrowableProcessBuilder Calendar
• 12. Collectionspublic static <T> Iterator<T> emptyIterator()public static <T> ListIterator<T> emptyListIterator()public static <T> Enumeration<T> emptyEnumeration()
• 13. // Iterator// Collections.emptyXXX()public Iterator<E> iterator() { if (data == null) { return Collections.emptyIterator(); } // ...}
• 14. Objects Short Long Integer Character Byte Boolean CollectionsAssertionError InetAddress Throwable ProcessBuilder Calendar
• 15. AssertionErrorpublic AssertionError(String message, Throwable cause)
• 16. AssertionError(String, Throwable)try { Class.forName(" ");} catch (ClassNotFoundException e) { // try-catch // // throw new AssertionError(" (^o^) ", e);}
• 17. Objects Short Long Integer Character Byte Boolean CollectionsAssertionErrorInetAddress ThrowableProcessBuilder Calendar