I have been learning Java for about 3 months. Joined SES from inexperienced, while receiving Java training I am studying Java SE 11 Silver on Saturdays and Sundays.
Since the content of the company training was up to Java 7, there were many contents for the first time, This time, I will summarize three methods of the Arrays class of Kuromoto Chapter 9 API.
[1.asList method](# 1asList method) [2.compare method](# 2compare method) [3.mismatch method](# 3mismatch method)
Convert from array to list. Returns a fixed size list that works with the specified array. Therefore, it cannot be added or removed. (An exception "UnsupportedOperationException" is thrown when trying to add or remove)
Both generate a fixed length list. AsList is a mutable (variable) that can change elements (set), List.of is immutable and immutable.
Compare the order when the two arrays are arranged in dictionary order (alphabetical order). 0 if the two arrays passed as arguments are equal, If the first argument is lexicographically ahead of the second argument, then a negative value, If the second argument comes first, it returns a positive value.
Returns true if the methods that check if the two arrays are equal are equal.
Compare the elements of the two arrays passed as arguments in order from the beginning. Returns the subscript (index) of the element that did not match first. Returns -1 if all elements match.
Both are methods introduced in Java 9. I wish I could have included the sample code, I'm glad I was able to organize my mind.
Java SE 11 & JDK 11 Arrays [Thorough capture Java SE 11 Silver problem collection](https://www.amazon.co.jp/%E5%BE%B9%E5%BA%95%E6%94%BB%E7%95%A5Java-SE- 11-Silver% E5% 95% 8F% E9% A1% 8C% E9% 9B% 86-1Z0-815 / dp / 4295007625 / ref = sr_1_1? __mk_ja_JP =% E3% 82% AB% E3% 82% BF% E3 % 82% AB% E3% 83% 8A & crid = 292UROQ3DD33J & dchild = 1 & keywords = java + silver & qid = 1604741554 & sprefix = Java% 2Caps% 2C260 & sr = 8-1)
Recommended Posts