- Arrays
public static void main(String[] args) { //binarySearch,注意二分查找要求数组有序 int[] nums1 = {2,4,6,8,10}; Arrays.binarySearch(nums1, 1);//返回-1 Arrays.binarySearch(nums1, 8);//返回3 //copyOf,截取or用0填充,该拷贝不影响原来的数组 int[] nums2 = Arrays.copyOf(nums1, 3); //copyOfRange,一定范围内截取 int[] nums3 = Arrays.copyOfRange(nums1, 2, 10); //fill,填充+范围填充 Arrays.fill(nums3, 0); Arrays.fill(nums3, 0, 4, 0); //sort,排序 int[] nums4 = {2,4,10,8,6}; Arrays.sort(nums4); }
- HashMap<K,V>
- (TODO)
原文地址:https://www.cnblogs.com/ulyssescat/p/10074171.html
时间: 2024-10-13 05:10:22